// defaultPrimaryKeyValueProvider ve defaultTimestampValueProvider 0 da geçilebilir, bu değerler sadece mapping sırasında kullanılacak internal static EntityMapper NewTableEntity <T>(object tableName, Enum schemaName, Enum connectionName, PrimaryKeyValueProvider defaultPrimaryKeyValueProvider, TimestampValueProvider defaultTimestampValueProvider) { DB.throwIfKeyAlreadyExists <Type, EntityMapping, MappingException>(Map.entityMappingDictionaryAtMapper, typeof(T)); DB.throwIfNullOrEmpty <MappingException>(tableName, "Table name"); DB.throwIfNullOrEmpty <MappingException>(schemaName, "Schema name"); DB.throwIfNullOrEmpty <MappingException>(connectionName, "Connection name"); EntityMapping entityMapping = new EntityMapping(tableName.ToString(), schemaName.ToString(), connectionName.ToString(), typeof(T)); Map.entityMappingDictionaryAtMapper.Add(typeof(T), entityMapping); return(new EntityMapper(entityMapping, defaultPrimaryKeyValueProvider, defaultTimestampValueProvider)); }
internal void NewTimestamp <T>(Enum columnName, Expression <Func <T, object> > memberExpression, Enum schemaName, Enum dbFunctionName, Func <object> functionDelegate, TimestampValueProvider timestampValueProvider) { string nestedTimestampPropertyName = parseNestedPropertyNameFromMemberExpression <T>(memberExpression); DB.throwIfNullOrEmpty <MappingException>(nestedTimestampPropertyName, "Timestamp property name"); DB.throwIfNullOrEmpty <MappingException>(columnName, "Column name"); if (timestampValueProvider == TimestampValueProvider.AppFunctionDelegate) { DB.throwIfNullOrEmpty <MappingException>(functionDelegate, "Function delegate"); } else if (timestampValueProvider == TimestampValueProvider.DBFunction) { //DB.throwIfNullOrEmpty<MappingException>(schemaName, "Schema name"); DB.throwIfNullOrEmpty <MappingException>(dbFunctionName, "DB function name"); } entityMapping.TimestampMapping = new TimestampMapping(columnName.ToString(), nestedTimestampPropertyName, schemaName, dbFunctionName, functionDelegate, timestampValueProvider); newColumn(columnName, nestedTimestampPropertyName, true, false); entityMapping.throwIfAutoSetAndTimestampColumn(columnName.ToString()); }
internal EntityMapper(EntityMapping entityMapping, PrimaryKeyValueProvider defaultPrimaryKeyValueProvider, TimestampValueProvider defaultTimestampValueProvider) { this.entityMapping = entityMapping; DefaultPrimaryKeyValueProvider = defaultPrimaryKeyValueProvider; DefaultTimestampValueProvider = defaultTimestampValueProvider; }
public static TableEntityMapper <T> Table(object tableName, Enum schemaName, Enum connectionName, PrimaryKeyValueProvider defaultPrimaryKeyValueProvider, TimestampValueProvider defaultTimestampValueProvider) { lock (Map.lockerForMap) { EntityMapper entityMapper = EntityMapper.NewTableEntity <T>(tableName, schemaName, connectionName, defaultPrimaryKeyValueProvider, defaultTimestampValueProvider); return(new TableEntityMapper <T>(entityMapper)); } }