public virtual DbEntityProvider New(QueryPolicy policy) { var n = New(this.Connection, this.Mapping, policy); n.Log = this.Log; return(n); }
public static Expression Build(QueryLinguist linguist, QueryPolicy policy, Expression expression, Expression provider) { var executor = Expression.Parameter(typeof(QueryExecutor), "executor"); var builder = new ExecutionBuilder(linguist, policy, executor); builder.variables.Add(executor); builder.initializers.Add(Expression.Call(Expression.Convert(provider, typeof(ICreateExecutor)), "CreateExecutor", null, null)); var result = builder.Build(expression); return(result); }
public EntityProvider(QueryLanguage language, QueryMapping mapping, QueryPolicy policy) { if (language == null) { throw new InvalidOperationException("Language not specified"); } if (mapping == null) { throw new InvalidOperationException("Mapping not specified"); } if (policy == null) { throw new InvalidOperationException("Policy not specified"); } this.language = language; this.mapping = mapping; this.policy = policy; this.tables = new Dictionary <MappingEntity, IEntityTable>(); }
public static DbEntityProvider From(string provider, string connectionString, QueryMapping mapping, QueryPolicy policy) { if (provider == null) { var clower = connectionString.ToLower(); // try sniffing connection to figure out provider if (clower.Contains(".mdb") || clower.Contains(".accdb")) { provider = "IQToolkit.Data.Access"; } else if (clower.Contains(".sdf")) { provider = "IQToolkit.Data.SqlServerCe"; } else if (clower.Contains(".sl3") || clower.Contains(".db3")) { provider = "IQToolkit.Data.SQLite"; } else if (clower.Contains(".mdf")) { provider = "IQToolkit.Data.SqlClient"; } else { throw new InvalidOperationException(string.Format("Query provider not specified and cannot be inferred.")); } } Type providerType = GetProviderType(provider); if (providerType == null) { throw new InvalidOperationException(string.Format("Unable to find query provider '{0}'", provider)); } return(From(providerType, connectionString, mapping, policy)); }
public static DbEntityProvider From(string provider, string connectionString, string mappingId, QueryPolicy policy) { return(From(provider, connectionString, GetMapping(mappingId), policy)); }
public static DbEntityProvider From(string connectionString, QueryMapping mapping, QueryPolicy policy) { return(From((string)null, connectionString, mapping, policy)); }
public virtual DbEntityProvider New(DbConnection connection, QueryMapping mapping, QueryPolicy policy) { return((DbEntityProvider)Activator.CreateInstance(this.GetType(), new object[] { connection, mapping, policy })); }
public override DbEntityProvider New(DbConnection connection, QueryMapping mapping, QueryPolicy policy) { return(new SqlQueryProvider((SqlConnection)connection, mapping, policy)); }
public SqlQueryProvider(SqlConnection connection, QueryMapping mapping, QueryPolicy policy) : base(connection, TSqlLanguage.Default, mapping, policy) { }
private RelationshipIncluder(QueryMapper mapper) { this.mapper = mapper; this.policy = mapper.Translator.Police.Policy; }
public QueryPolice(QueryPolicy policy, QueryTranslator translator) { this.policy = policy; this.translator = translator; }
public QueryTranslator(QueryLanguage language, QueryMapping mapping, QueryPolicy policy) { this.linguist = language.CreateLinguist(this); this.mapper = mapping.CreateMapper(this); this.police = policy.CreatePolice(this); }
public static Expression Rewrite(QueryPolicy policy, QueryLanguage language, Expression expression) { return(new ClientJoinedProjectionRewriter(policy, language).Visit(expression)); }
private ClientJoinedProjectionRewriter(QueryPolicy policy, QueryLanguage language) { this.policy = policy; this.language = language; }
public static DbEntityProvider From(Type providerType, string connectionString, QueryMapping mapping, QueryPolicy policy) { Type adoConnectionType = GetAdoConnectionType(providerType); if (adoConnectionType == null) { throw new InvalidOperationException(string.Format("Unable to deduce ADO provider for '{0}'", providerType.Name)); } DbConnection connection = (DbConnection)Activator.CreateInstance(adoConnectionType); // is the connection string just a filename? if (!connectionString.Contains('=')) { MethodInfo gcs = providerType.GetMethod("GetConnectionString", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(string) }, null); if (gcs != null) { var getConnectionString = (Func <string, string>)Delegate.CreateDelegate(typeof(Func <string, string>), gcs); connectionString = getConnectionString(connectionString); } } connection.ConnectionString = connectionString; return((DbEntityProvider)Activator.CreateInstance(providerType, new object[] { connection, mapping, policy })); }
public DbEntityProvider(DbConnection connection, QueryLanguage language, QueryMapping mapping, QueryPolicy policy) : base(language, mapping, policy) { if (connection == null) { throw new InvalidOperationException("Connection not specified"); } this.connection = connection; }
private ExecutionBuilder(QueryLinguist linguist, QueryPolicy policy, Expression executor) { this.linguist = linguist; this.policy = policy; this.executor = executor; }