Ejemplo n.º 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);
                }
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
 public static MListMapping <T> AsMListMapping <T>(this Mapping <MList <T> > mapping) where T : class
 {
     return((MListMapping <T>)mapping.Target);
 }
Ejemplo n.º 5
0
        public LiteMapping()
        {
            EntityMapping = Mapping.New <S>();

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