예제 #1
0
파일: OrderFactory.cs 프로젝트: Jaans/csla
 public Order Fetch(int id)
 {
   var obj = (Order)MethodCaller.CreateInstance(typeof(Order));
   var item = (from r in MockDb.Orders
               where r.Id == id
               select r).First();
   using (BypassPropertyChecks(obj))
   {
     LoadProperty(obj, Order.IdProperty, item.Id);
     LoadProperty(obj, Order.CustomerNameProperty, item.CustomerName);
     var lif = new LineItemFactory();
     LoadProperty(obj, Order.LineItemsProperty, lif.FetchItems(id));
   }
   MarkOld(obj);
   return obj;
 }
예제 #2
0
        public Order Fetch(int id)
        {
            var obj  = (Order)MethodCaller.CreateInstance(typeof(Order));
            var item = (from r in MockDb.Orders
                        where r.Id == id
                        select r).First();

            using (BypassPropertyChecks(obj))
            {
                LoadProperty(obj, Order.IdProperty, item.Id);
                LoadProperty(obj, Order.CustomerNameProperty, item.CustomerName);
                var lif = new LineItemFactory();
                LoadProperty(obj, Order.LineItemsProperty, lif.FetchItems(id));
            }
            MarkOld(obj);
            return(obj);
        }
예제 #3
0
        public Order Fetch(int id)
        {
            var obj  = ApplicationContext.CreateInstanceDI <Order>();
            var item = (from r in MockDb.Orders
                        where r.Id == id
                        select r).First();

            using (BypassPropertyChecks(obj))
            {
                LoadProperty(obj, Order.IdProperty, item.Id);
                LoadProperty(obj, Order.CustomerNameProperty, item.CustomerName);
                var lif = new LineItemFactory(ApplicationContext);
                LoadProperty(obj, Order.LineItemsProperty, lif.FetchItems(id));
            }
            MarkOld(obj);
            return(obj);
        }