Esempio n. 1
0
        public Persist(Func <Type, MemberInfo, int> membersOrder = null, AllowNull allowNull = AllowNull.None)
        {
            Type         = typeof(T);
            AllowNull    = allowNull;
            MembersOrder = membersOrder;

            LambdaWrite = CreateWriteMethod();
            write       = LambdaWrite.Compile();

            LambdaRead = CreateReadMethod();
            read       = LambdaRead.Compile();
        }
Esempio n. 2
0
        public DataPersist(DataType dataType)
        {
            bool supported = dataType.IsPrimitive || (dataType.IsSlotes && dataType.AreAllTypesPrimitive);

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

            DataType = dataType;
            Type     = DataTypeUtils.GetDataType(dataType);

            //prepare Write
            LambdaWrite = CreateWriteMethod();
            write       = LambdaWrite.Compile();

            //prepare Read
            LambdaRead = CreateReadMethod();
            read       = LambdaRead.Compile();
        }