private static Delegate GenerateSingleMapper() { var config = new CustomConfig(); var selectQuery = new SelectQuery<Post>(new Mock<ISelectQueryExecutor>().Object).Fetch(p => p.Blog) as SelectQuery<Post>; var writer = new SelectWriter(new SqlServer2012Dialect(), config); var result = writer.GenerateSql(selectQuery); var mapper = new NonCollectionMapperGenerator(config); var func = mapper.GenerateNonCollectionMapper<Post>(result.FetchTree); return func.Item1; }
private static Delegate GenerateSingleMapper() { var config = new CustomConfig(); var selectQuery = new SelectQuery <Post>(new Mock <ISelectQueryExecutor>().Object).Fetch(p => p.Blog) as SelectQuery <Post>; var writer = new SelectWriter(new SqlServer2012Dialect(), config); var result = writer.GenerateSql(selectQuery); var mapper = new NonCollectionMapperGenerator(config); var func = mapper.GenerateNonCollectionMapper <Post>(result.FetchTree); return(func.Item1); }
private static Delegate GenerateMultipleNoCollectionMapper() { var config = new CustomConfig(); var selectQuery = new SelectQuery <Comment>(new Mock <IProjectedSelectQueryExecutor>().Object).Fetch(c => c.Post.Author) as SelectQuery <Comment>; var writer = new SelectWriter(new SqlServer2012Dialect(), config); var result = writer.GenerateSql(selectQuery, new AutoNamingDynamicParameters()); var mapper = new NonCollectionMapperGenerator(config); var func = mapper.GenerateNonCollectionMapper <Comment>(result.FetchTree); return(func.Item1); }
public DelegateQueryCreator(IConfiguration configuration) { this.nonCollectionMapperGenerator = new NonCollectionMapperGenerator(configuration); this.singleCollectionMapperGenerator = new SingleCollectionMapperGenerator(configuration); this.multiCollectionMapperGenerator = new MultiCollectionMapperGenerator(configuration); this.configuration = configuration; this.mapperFactories = new ConcurrentDictionary <Tuple <Type, string>, Tuple <Delegate, Type[]> >(); this.multiCollectionMapperFactories = new ConcurrentDictionary <Tuple <Type, string>, Tuple <Delegate, Type[], Type[]> >(); this.collectionQueries = new ConcurrentDictionary <Tuple <Type, string>, Delegate>(); this.asyncCollectionQueries = new ConcurrentDictionary <Tuple <Type, string>, Delegate>(); this.noCollectionQueries = new ConcurrentDictionary <Tuple <Type, string>, Delegate>(); this.asyncNoCollectionQueries = new ConcurrentDictionary <Tuple <Type, string>, Delegate>(); }