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(); }
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(); }
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(); }