Esempio n. 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))));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 4
0
 /// <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;
 }
Esempio n. 5
0
 /// <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);
 }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }