Ejemplo n.º 1
0
        public DataIndexerPersist(DataType dataType, IIndexerPersist[] persists)
        {
            bool supported = dataType.IsPrimitive || (dataType.IsSlotes && dataType.AreAllTypesPrimitive);

            if (!supported)
            {
                throw new NotSupportedException(dataType.ToString());
            }

            DataType = dataType;
            Persists = persists;

            if (DataType.IsPrimitive)
            {
                LambdaStore = CreateStoreMethodSingleSlot();
                LambdaLoad  = CreateLoadMethodSingleSlot();
            }
            else
            {
                LambdaStore = CreateStoreMethod();
                LambdaLoad  = CreateLoadMethod();
            }

            store = LambdaStore.Compile();
            load  = LambdaLoad.Compile();
        }
Ejemplo n.º 2
0
        public IndexerPersist(IIndexerPersist[] persists, Func <Type, MemberInfo, int> membersOrder = null)
        {
            Type         = typeof(T);
            MembersOrder = membersOrder;
            Persists     = persists;

            LambdaStore = CreateStoreMethod();
            store       = LambdaStore.Compile();

            LambdaLoad = CreateLoadMethod();
            load       = LambdaLoad.Compile();
        }
Ejemplo n.º 3
0
        public DataIndexerPersist(Type type, IIndexerPersist[] persists, Func <Type, MemberInfo, int> membersOrder = null)
        {
            Persists = persists;
            Type     = type;

            MembersOrder = membersOrder;

            LambdaStore = CreateStoreMethod();
            store       = LambdaStore.Compile();

            LambdaLoad = CreateLoadMethod();
            load       = LambdaLoad.Compile();
        }