static void Main(string[] args)
        {
            using (ACDatabaseEntities dbContext = new ACDatabaseEntities())
            {
                dbContext.Configuration.ProxyCreationEnabled = false;
                dbContext.Configuration.LazyLoadingEnabled   = false;

                var xxx = dbContext.Graphs.Include(p => p.EnteryNode).Include(p => p.Nodes).FirstOrDefault();

                if (xxx != null)
                {
                    xxx.EnteryNodeId = 2;
                    dbContext.SaveChanges();
                }

                //   Console.WriteLine(414);
                //var x = dbContext.Nodes.Find(1);
                //var y = dbContext.Nodes.Find(10);

                //var a = x.NodeAttributes.Select(fx => fx.Attribute);
                //var b = y.NodeAttributes.Select(fx => fx.Attribute);

                //var x = dbContext.Graphs.Add(new Graph() { Name = "YEHOVA" });
                //var g = new Graph() { Name = "YEHOVA", Id = 1 };
                //dbContext.Graphs.Attach(g);

                //dbContext.Nodes.Add(new DAL.EF.Node() { Name = "MICHAEL", GraphId = 1, Data = "FAFA", });

                //INodeRepository nodeRepository = new NodeRepository(dbContext);
                //nodeRepository.EnsureTransaction();
                //nodeRepository.Add(new DAL.EF.Node() { Name = "MICHAEL", GraphId = 1, Data = "FAFA", });
                //Console.WriteLine(nodeRepository.SaveChangesAsync().Result);
                //nodeRepository.Dispose();
            }
        }
Beispiel #2
0
 public DatabaseTransaction(ACDatabaseEntities dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException();
     _dbContext.Configuration.LazyLoadingEnabled   = false;
     _dbContext.Configuration.ProxyCreationEnabled = false;
 }
 public BaseRepository(ACDatabaseEntities context) : base(context)
 {
 }