예제 #1
0
        protected internal virtual MappingContext <T> ApplyChanges <T>(ControllerBase controller, T entity, string prefix, Mapping <T> mapping, PropertyRoute route, SortedList <string, string> inputs) where T : ModifiableEntity
        {
            using (HeavyProfiler.Log("ApplyChanges", () => typeof(T).TypeName()))
                using (new EntityCache(EntityCacheType.Normal))
                {
                    EntityCache.AddFullGraph((ModifiableEntity)entity);

                    RootContext <T> ctx = new RootContext <T>(prefix, inputs, route, controller)
                    {
                        Value = entity
                    };
                    mapping(ctx);
                    return(ctx);
                }
        }
예제 #2
0
        public static MappingContext <T> ApplyChanges <T>(this T entity, ControllerBase controller, string prefix = null, PropertyRoute route = null, SortedList <string, string> inputs = null) where T : ModifiableEntity
        {
            Mapping <T> mapping = (Mapping <T>)Navigator.EntitySettings(typeof(T)).UntypedMappingMain;

            return(ApplyChanges <T>(entity, controller, mapping, prefix, route, inputs));
        }
예제 #3
0
        public static MappingContext <T> ApplyChanges <T>(this T entity, ControllerBase controller, Mapping <T> mapping, string prefix = null, PropertyRoute route = null, SortedList <string, string> inputs = null) where T : ModifiableEntity
        {
            if (prefix == null)
            {
                prefix = controller.Prefix();
            }

            if (inputs == null)
            {
                inputs = controller.ControllerContext.HttpContext.Request.Form.ToSortedList(prefix);
            }

            if (route == null)
            {
                if (!typeof(IRootEntity).IsAssignableFrom(typeof(T)))
                {
                    throw new InvalidOperationException("In order to use ApplyChanges with EmbeddedEntities set 'route' argument");
                }

                route = PropertyRoute.Root(typeof(T));
            }

            return(Manager.ApplyChanges <T>(controller, entity, prefix, mapping, route, inputs));
        }
예제 #4
0
 public static MListMapping <T> AsMListMapping <T>(this Mapping <MList <T> > mapping) where T : class
 {
     return((MListMapping <T>)mapping.Target);
 }
예제 #5
0
        public LiteMapping()
        {
            EntityMapping = Mapping.New <S>();

            EntityHasChanges = AnyNonSpecialImput;
        }
예제 #6
0
 public static EntityMapping <T> AsEntityMapping <T>(this Mapping <T> mapping) where T : ModifiableEntity
 {
     return((EntityMapping <T>)mapping.Target);
 }
예제 #7
0
 public static AutoEntityMapping <T> AsAutoEntityMapping <T>(this Mapping <T> mapping) where T : class
 {
     return((AutoEntityMapping <T>)mapping.Target);
 }
예제 #8
0
 public MListDictionaryMapping(Expression <Func <S, K> > getKeyExpression)
     : this(getKeyExpression, Mapping.New <S>())
 {
 }
예제 #9
0
 public static void RegisterValue <T>(Mapping <T> mapping)
 {
     MappingRepository <T> .Mapping = mapping;
 }
예제 #10
0
 public MListCorrelatedMapping(Mapping <S> elementMapping)
     : base(elementMapping)
 {
 }
예제 #11
0
 public MListMapping(Mapping <S> elementMapping)
     : base(elementMapping)
 {
 }
예제 #12
0
 public BaseMListMapping <S> SetElementMapping(Mapping <S> elementMapping)
 {
     this.ElementMapping = elementMapping;
     return(this);
 }
예제 #13
0
 public BaseMListMapping(Mapping <S> elementMapping)
 {
     this.ElementMapping = elementMapping;
 }
예제 #14
0
 public BaseMListMapping()
 {
     ElementMapping = Mapping.New <S>();
 }