예제 #1
0
        public PropertyMappingBuilder <TModel> MapProperty(string propertyName, NpgsqlDbType dbType)
        {
            var modelType = typeof(TModel);

            TypeMappingStorage.AddMapping(ContextType, modelType, propertyName, dbType);
            return(this);
        }
        public static DbContextOptionsBuilder UseCopyTypeMapping <TContext>(
            this DbContextOptionsBuilder optionsBuilder,
            Action <TypeMappingBuilder> mapType)
            where TContext : DbContext
        {
            var contextType = typeof(TContext);

            if (!TypeMappingStorage.ContextMappingConfigured(contextType))
            {
                var typeMappingBuilder = new TypeMappingBuilder {
                    ContextType = contextType
                };
                mapType(typeMappingBuilder);
            }

            return(optionsBuilder);
        }
예제 #3
0
 private NpgsqlDbType?GetDbType(PropertyInfo propertyInfo, Type contextType)
 {
     return(TypeMappingStorage.TryGetDbType(contextType, propertyInfo.DeclaringType, propertyInfo.Name));
 }