ノーコードでクラウド上のデータとの連携を実現。
詳細はこちら →無償トライアル:
無償トライアルへ製品の情報と無償トライアルへ:
Bullhorn CRM データに連携する.NET アプリケーションを素早く、簡単に開発できる便利なドライバー。
加藤龍彦
ウェブデベロッパー
ADO.NET Adapter
Entity Framework はobject-relational mapping フレームワークで、データをオブジェクトとして扱うために使われます。Visual Studio のADO.NET Entity Data Model ウィザードを実行するとEntity Model を作成できますが、このモデルファーストアプローチでは、データソースに変更があった場合やエンティティ操作をより制御したい場合は不都合があります。この記事では、CData ADO.NET Provider を使いコードファーストアプローチでBullhorn CRM にアクセスします。
Begin by providing your Bullhorn CRM account credentials in the following:
If you are uncertain about your data center code, codes like CLS2, CLS21, etc. are cluster IDs that are contained in a user's browser URL (address bar) once they are logged in.
Example: https://cls21.bullhornstaffing.com/BullhornSTAFFING/MainFrame.jsp?#no-ba... indicates that the logged in user is on CLS21.
Bullhorn CRM uses the OAuth 2.0 authentication standard. To authenticate using OAuth, create and configure a custom OAuth app. See the Help documentation for more information.
<configuration>
... <connectionStrings>
<add name="BullhornCRMContext" connectionString="Offline=False;DataCenterCode=CLS33;OAuthClientId=myoauthclientid;OAuthClientSecret=myoauthclientsecret;" providerName="System.Data.CData.BullhornCRM" />
</connectionStrings>
<entityFramework>
<providers>
... <provider invariantName="System.Data.CData.BullhornCRM" type="System.Data.CData.BullhornCRM.BullhornCRMProviderServices, System.Data.CData.BullhornCRM.Entities.EF6" />
</providers>
<entityFramework>
</configuration>
</code>
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;
class BullhornCRMContext :DbContext {
public BullhornCRMContext() { }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { // To remove the requests to the Migration History table
Database.SetInitializer<BullhornCRMContext>(null); // To remove the plural names modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
}
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;
public class Candidate {
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public System.String Id { get; set; }
public System.String Id { get; set; }
}
public class CandidateMap :EntityTypeConfiguration<Candidate> {
public CandidateMap() {
this.ToTable("Candidate");
this.HasKey(Candidate => Candidate.Id);
this.Property(Candidate => Candidate.Id);
}
}
public DbSet<Candidate> Candidate { set; get; }
BullhornCRMContext context = new BullhornCRMContext();
context.Configuration.UseDatabaseNullSemantics = true;
var query = from line in context.Candidate select line;