ノーコードでクラウド上のデータとの連携を実現。
詳細はこちら →30日間の無償トライアル
無償トライアルはこちら製品の詳細
QuickBooks Point of Sale への完全な読み書きアクセスにより、任意の.NET アプリケーションから検索(顧客、トランザクション、請求書、販売レシートなど)、アイテムの更新、顧客の編集などを実行できます。
CData
こんにちは!ウェブ担当の加藤です。マーケ関連のデータ分析や整備もやっています。
Entity Framework はobject-relational mapping フレームワークで、データをオブジェクトとして扱うために使われます。Visual Studio のADO.NET Entity Data Model ウィザードを実行するとEntity Model を作成できますが、このモデルファーストアプローチでは、データソースに変更があった場合やエンティティ操作をより制御したい場合は不都合があります。この記事では、CData ADO.NET Provider を使いコードファーストアプローチでQuickBooks POS にアクセスします。
ローカルQuickBooks インスタンスに接続する場合は、接続プロパティを設定する必要はありません。
CData 製品 はリモートコネクタ経由でQuickBooks にリクエストを作成します。リモートコネクタはQuickBooks POS と同じマシン上で動作し、軽量の組み込みWeb サーバーを介して接続を受け入れます。サーバーはSSL/TLS をサポートし、ユーザーにリモートマシンからのセキュアな接続を可能にします。
初めて接続するときは、リモートコネクタをQuickBooks POS で認可する必要があります。詳細はヘルプドキュメントの「はじめに」を参照してください。
<configuration>
... <connectionStrings>
<add name="QuickBooksPOSContext" connectionString="Offline=False;" providerName="System.Data.CData.QuickBooksPOS" />
</connectionStrings>
<entityFramework>
<providers>
... <provider invariantName="System.Data.CData.QuickBooksPOS" type="System.Data.CData.QuickBooksPOS.QuickBooksPOSProviderServices, System.Data.CData.QuickBooksPOS.Entities.EF6" />
</providers>
<entityFramework>
</configuration>
</code>
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;
class QuickBooksPOSContext :DbContext {
public QuickBooksPOSContext() { }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { // To remove the requests to the Migration History table
Database.SetInitializer<QuickBooksPOSContext>(null); // To remove the plural names modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
}
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;
public class Customers {
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public System.String ListId { get; set; }
public System.String ListId { get; set; }
}
public class CustomersMap :EntityTypeConfiguration<Customers> {
public CustomersMap() {
this.ToTable("Customers");
this.HasKey(Customers => Customers.ListId);
this.Property(Customers => Customers.ListId);
}
}
public DbSet<Customers> Customers { set; get; }
QuickBooksPOSContext context = new QuickBooksPOSContext();
context.Configuration.UseDatabaseNullSemantics = true;
var query = from line in context.Customers select line;