Example #1
0
        public static ItemStoreDto ToDtoWithRelated(this ContosoUniversity.DAL.SalesModel.ItemStore source, int level)
        {
            if (source == null)
            {
                return(null);
            }

            var target = new ItemStoreDto();

            // Properties
            target.Id       = source.Id;
            target.MinLimit = source.MinLimit;
            target.MaxLimit = source.MaxLimit;
            target.Quantity = source.Quantity;
            target.ItemId   = source.ItemId;
            target.StoreId  = source.StoreId;

            // Navigation Properties
            if (level > 0)
            {
                target.Item  = source.Item.ToDtoWithRelated(level - 1);
                target.Store = source.Store.ToDtoWithRelated(level - 1);
            }

            // User-defined partial method
            OnDtoCreating(source, target);

            return(target);
        }
Example #2
0
        public static ContosoUniversity.DAL.SalesModel.ItemStore ToEntity(this ItemStoreDto source)
        {
            if (source == null)
            {
                return(null);
            }

            var target = new ContosoUniversity.DAL.SalesModel.ItemStore();

            // Properties
            target.Id       = source.Id;
            target.MinLimit = source.MinLimit;
            target.MaxLimit = source.MaxLimit;
            target.Quantity = source.Quantity;
            target.ItemId   = source.ItemId;
            target.StoreId  = source.StoreId;

            // User-defined partial method
            OnEntityCreating(source, target);

            return(target);
        }
Example #3
0
 static partial void OnEntityCreating(ItemStoreDto source, ContosoUniversity.DAL.SalesModel.ItemStore target);
Example #4
0
 static partial void OnDtoCreating(ContosoUniversity.DAL.SalesModel.ItemStore source, ItemStoreDto target);