ノーコードでクラウド上のデータとの連携を実現。
詳細はこちら →Marketo Data Provider の30日間無償トライアルをダウンロード
30日間の無償トライアルへ製品の詳細
Marketo ADO.NET Provider 相談したいMarketo マーケティング自動化データ(潜在顧客、営業案件、チャンネル、キャンペーンなど)を組み込んだパワフルな.NET アプリケーションを短時間・低コストで作成して配布できます。
CData
こんにちは!ウェブ担当の加藤です。マーケ関連のデータ分析や整備もやっています。
Entity Framework はobject-relational mapping フレームワークで、データをオブジェクトとして扱うために使われます。Visual Studio のADO.NET Entity Data Model ウィザードを実行するとEntity Model を作成できますが、このモデルファーストアプローチでは、データソースに変更があった場合やエンティティ操作をより制御したい場合は不都合があります。この記事では、CData ADO.NET Provider を使いコードファーストアプローチでMarketo にアクセスします。
REST およびSOAP API の両方をサポートしています。Schema プロパティで選択してください。
REST API: OAuth とREST セクションでOAuthClientId、OAuthClientSecret、RESTEndpoint プロパティを設定。
SOAP API: SOAP セクションでUserId、EncryptionKey、SOAPEndpoint プロパティを設定。
詳細はヘルプドキュメントの「はじめに」を参照してください。
<configuration>
... <connectionStrings>
<add name="MarketoContext" connectionString="Offline=False;Schema=REST;RESTEndpoint=https://311-IFS-929.mktorest.com/rest;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;" providerName="System.Data.CData.Marketo" />
</connectionStrings>
<entityFramework>
<providers>
... <provider invariantName="System.Data.CData.Marketo" type="System.Data.CData.Marketo.MarketoProviderServices, System.Data.CData.Marketo.Entities.EF6" />
</providers>
<entityFramework>
</configuration>
</code>
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;
class MarketoContext :DbContext {
public MarketoContext() { }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { // To remove the requests to the Migration History table
Database.SetInitializer<MarketoContext>(null); // To remove the plural names modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
}
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;
public class Leads {
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public System.String Id { get; set; }
public System.String Email { get; set; }
}
public class LeadsMap :EntityTypeConfiguration<Leads> {
public LeadsMap() {
this.ToTable("Leads");
this.HasKey(Leads => Leads.Id);
this.Property(Leads => Leads.Email);
}
}
public DbSet<Leads> Leads { set; get; }
MarketoContext context = new MarketoContext();
context.Configuration.UseDatabaseNullSemantics = true;
var query = from line in context.Leads select line;