示例#1
0
 private static void DCTTest()
 {
     DCTExample.Execute(data =>
     {
         ConsoleHelper.SendMessage($"Context 1 ID {data.Id}");
         DCTExample.Execute(data2 =>
         {
             ConsoleHelper.SendMessage($"Context 2 ID {data2.Id}");
         });
         DCT.Execute(data3 =>
         {
             ConsoleHelper.SendMessage($"Context 3 ID {data3.Id}");
             DCT.Execute(data4 =>
             {
                 ConsoleHelper.SendMessage($"Context 4 ID {data4.Id}");
             });
         });
         InternalMethod();
     });
     DCTExample.Execute(data =>
     {
         ConsoleHelper.SendMessage($"Context 5 ID {data.Id}");
         InternalMethod();
     });
     DCTExample.ExecuteAsync(data =>
     {
         ConsoleHelper.SendMessage($"Context 6 ID {data.Id}");
         InternalMethod();
     });
 }
示例#2
0
        static void Main(string[] args)
        {
            CoreTest();
            DCTExample.Execute(c =>
            {
                QueueTaskController2();
                //var r = new Model3();
                //r.StateEnum = Model3State.Edit;
                //r.StateEnum = Model3State.Edit;
                //c.SaveChanges();
                //r.StateEnum = Model3State.Complete;
                //c.SaveChanges();
                //r.StateEnum = Model3State.Edit;
                //c.SaveChanges();
                //var r2 = new Model3();
                //r2.StateEnum = Model3State.Complete;
                //c.SaveChanges();
                ////DataComponentTest();
                //var list = Model3.DbSet().ToArray();
                //foreach (var item in list)
                //{
                //    ConsoleHelper.Send("Info", $"Create={item.ToString()} Description={item.Description}");
                //}
                //var model = new ModelX();
                //var visualModel = model._ConvertToServiceModel<ModelXService>();
            });

            Console.Read();
        }
示例#3
0
 public static void EntityTest()
 {
     DCTExample.Execute(c =>
     {
         c.FirstModels.Add(new _0_Base.Models.FirstModel()
         {
             Decription = "1"
         });
         EntityTest2();
         c.FirstModels.Add(new _0_Base.Models.FirstModel()
         {
             Decription = "3"
         });
         c.SaveChanges();
     });
 }
示例#4
0
        public static void DataComponentTest()
        {
            //ALM
            var model = new ModelX();

            DCTExample.Execute(c =>
            {
                #region 1 default
                //Create + Create to Edited
                model.StateEnum = ModelXState.Edited;
                model._Save();
                DCTExample.Context.SaveChanges();

                //Edited to Edited2
                model.StateEnum = ModelXState.Edited2;
                model._Save();
                DCTExample.Context.SaveChanges();

                //Edited2 to Error
                model.StateEnum = ModelXState.Error;
                model._Save();
                DCTExample.Context.SaveChanges();
                #endregion
                #region 2 Create to Edited2 - error
                var model2 = new ModelX();
                //Create + Create to Edited
                model2.StateEnum = ModelXState.Edited2;
                model2._Save();
                DCTExample.Context.SaveChanges();
                #endregion
                #region 3 Create to Error - error
                var model3 = new ModelX();
                //Create + Create to Edited
                model3.StateEnum = ModelXState.Error;
                model3._Save();
                DCTExample.Context.SaveChanges();
                #endregion
                #region 4 Create to Edited
                var model4 = new ModelX();
                //Create + Create to Edited
                model4.StateEnum = ModelXState.Edited;
                model4._Save();
                DCTExample.Context.SaveChanges();
                #endregion
                #region 5 Create to Edited2
                var model5 = new ModelX();
                //Create + Create to Edited
                model5.StateEnum = ModelXState.Edited;
                model5._Save();
                DCTExample.Context.SaveChanges();
                model5.StateEnum = ModelXState.Edited2;
                model5._Save();
                DCTExample.Context.SaveChanges();
                #endregion



                //Query
                var set = model._DbSet();
                set     = ModelX.DbSet();
                set     = DCTExample.Context.DbSet <ModelX>();
                set     = c.DbSet <ModelX>();

                //Creators
                var visualModel = model._ConvertToServiceModel <ModelXService>();
            });
        }