Exemplo n.º 1
0
        private static Delegate CreateTypeMapping(Type typeT, SqlMetaData[] metaData)
        {
            var columns = metaData.Select((md, i) => (Thing) new Column(i, md.Name, Types.DBTypeToType[md.DbType])).ToList();
            var result  = Mapping.CreateFromDestination(Types.ReadablePublicThings(typeT), columns, typeT.Name);
            LambdaExpression lambdaExpression = CreateMappingLambda(typeT, result.Mapped);

            return(lambdaExpression.Compile());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates the mapping between <paramref name="source"/> and <paramref name="destination"/> using the DESTINATION to generate candidate names for the mapping
 /// </summary>
 public static MappingResult <Thing, Thing> CreateFromDestination(Type source, IReadOnlyCollection <Thing> destination, string removablePrefix = null)
 => CreateFromDestination(Types.ReadablePublicThings(source), destination, removablePrefix);
Exemplo n.º 3
0
 /// <summary>
 /// Creates the mapping between <paramref name="source"/> and <paramref name="destination"/> using the DESTINATION to generate candidate names for the mapping
 /// </summary>
 public static MappingResult <Thing, Thing> CreateFromDestination(Type source, Type destination, string removablePrefix = null)
 => CreateFromDestination(Types.ReadablePublicThings(source), Types.WriteablePublicThings(destination), removablePrefix);