コード例 #1
0
        private static void Batch_Upsert_Insert_NonIdentity()
        {
            const int len = 2;
            ZTEST[] arr = new ZTEST[len];
            int j = 0;
            while (j < len)
            {
                arr[j++] = new ZTEST() { Id = Guid.NewGuid(), Name = "Ekle Ulan" + j, No = 3003 + j, Price = 3003 + j };
            }

            IBatchCommandUpsert cmd = (IBatchCommandUpsert)Helper.Factory.CreateBatchCommand(BatchCommandType.Upsert);
            cmd.UpdatedFields = new HashSet<string>() { "Id", "Name" };
            cmd.InsertFields = new HashSet<string>() { "Id", "Name" };

            Console.WriteLine(cmd.Upsert(arr, BatchCommandMode.Batch, new EntityMetaDataProviderEF4(typeof(ZTEST))));

            arr = new ZTEST[len];
            j = 0;
            while (j < len)
            {
                arr[j++] = new ZTEST() { Id = Guid.NewGuid(), Name = "Ekle Ulan 999" + j, No = 9003 + j, Price = 9003 + j };
            }

            Console.WriteLine(cmd.Upsert(arr, BatchCommandMode.Single, new EntityMetaDataProviderEF4(typeof(ZTEST))));
        }
コード例 #2
0
        private static void Insert_NonIdentity()
        {
            ZTEST z = new ZTEST();
            z.Id = Guid.NewGuid();
            z.Name = "En Son";
            z.No = 1242;
            z.Price = 12.42M;

            Console.WriteLine(Helper.Factory.CreateEntityCommand(EntityCommandType.Insert).Execute(z));
        }
コード例 #3
0
        private static void UpsertInsert_NonIdentity()
        {
            ZTEST z = new ZTEST();
            z.Id = Guid.NewGuid();
            z.Name = ":)";
            z.No = 16;
            z.Price = 42.12M;

            IEntityCommandUpsert cmd = (IEntityCommandUpsert)Helper.Factory.CreateEntityCommand(EntityCommandType.Upsert);
            cmd.UpdatedFields = new HashSet<string>() { "Name" };
            cmd.InsertFields = new HashSet<string>() { "Id", "Name" };

            Console.WriteLine(cmd.Upsert(z));
        }
コード例 #4
0
ファイル: Model1.cs プロジェクト: mehmetgoren/AppXCommandTest
 /// <summary>
 /// Create a new ZTEST object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static ZTEST CreateZTEST(global::System.Guid id, global::System.String name)
 {
     ZTEST zTEST = new ZTEST();
     zTEST.Id = id;
     zTEST.Name = name;
     return zTEST;
 }
コード例 #5
0
ファイル: Model1.cs プロジェクト: mehmetgoren/AppXCommandTest
 /// <summary>
 /// Deprecated Method for adding a new object to the ZTESTs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToZTESTs(ZTEST zTEST)
 {
     base.AddObject("ZTESTs", zTEST);
 }
コード例 #6
0
        private static void UpsertInsert_NonIdentity()
        {
            ZTEST z = new ZTEST();
            z.Id = Guid.NewGuid();
            z.Name = "UpsertInsert Insert";
            z.No = 42;
            z.Price = 42.12M;

            Console.WriteLine(Util_SQLite.Adapter.Upsert(z));
        }
コード例 #7
0
        private static void Insert_NonIdentity()
        {
            ZTEST z = new ZTEST();
            z.Id = Guid.NewGuid();
            z.Name = "En Son";
            z.No = 1242;
            z.Price = 12.42M;

            Console.WriteLine(Util_SQLite.Adapter.Insert(z));
        }
コード例 #8
0
        private static void Batch_Upsert_Insert_NonIdentity()
        {
            const int len = 3;
            ZTEST[] arr = new ZTEST[len];
            int j = 0;
            while (j < len)
            {
                arr[j++] = new ZTEST() { Id = Guid.NewGuid(), Name = "Ekle Ulan" + j, No = 3003 + j, Price = 3003 + j };
            }
            Console.WriteLine(Util_SQLite.Adapter.BatchUpsert(arr, BatchCommandMode.Batch));

            arr = new ZTEST[len];
            j = 0;
            while (j < len)
            {
                arr[j++] = new ZTEST() { Id = Guid.NewGuid(), Name = "Ekle Ulan 999" + j, No = 9003 + j, Price = 9003 + j };
            }

            Console.WriteLine(Util_SQLite.Adapter.BatchUpsert(arr, BatchCommandMode.Single));
        }