public void DbSchema_CompoundKey() { StoreItemCollection ssdl = LoadSSDL("CompoundKey"); DbSchema schema = DbSchemaFactory.CreateDbSchema(ssdl); DbContainer container = new DbContainer(new DbContainerParameters()); container.Initialize(schema); }
internal EffortDataReader( IEnumerable result, int recordsAffected, FieldDescription[] fields, DbContainer container) { this.enumerator = result.GetEnumerator(); this.recordsAffected = recordsAffected; this.fields = fields; this.container = container; }
public static ITable GetTable( DbModificationCommandTree commandTree, DbContainer container) { DbScanExpression source = commandTree.Target.Expression as DbScanExpression; if (source == null) { throw new NotSupportedException( "The type of the Target property is not DbScanExpression"); } return container.Internal.GetTable(source.Target.GetTableName()); }
/// <summary> /// Initializes a new instance of the <see cref="ActionContext" /> class. /// </summary> /// <param name="container"> The container. </param> public ActionContext(DbContainer container) { this.container = container; this.parameters = new List<CommandActionParameter>(); }
/// <summary> /// Opens a database connection with the settings specified by the /// <see cref="P:System.Data.Common.DbConnection.ConnectionString" />. /// </summary> public override void Open() { EffortConnectionStringBuilder connectionString = new EffortConnectionStringBuilder(this.ConnectionString); string instanceId = connectionString.InstanceId; if (this.lastContainerId == instanceId) { // The id was not changed, so the appropriate container is associated this.ChangeConnectionState(ConnectionState.Open); return; } this.container = DbContainerStore.GetDbContainer(instanceId, this.CreateDbContainer); this.containerConfiguration = new DbContainerManagerWrapper(this.container); this.lastContainerId = instanceId; this.ChangeConnectionState(ConnectionState.Open); }
public DbContainerManagerWrapper(DbContainer container) { this.container = container; }
public static Expression GetEnumeratorExpression( DbExpression predicate, DbModificationCommandTree commandTree, DbContainer container, out ITable table) { TransformVisitor visitor = new TransformVisitor(container.TypeConverter); visitor.TableProvider = container; // Get the source expression ConstantExpression source = visitor.Visit(commandTree.Target.Expression) as ConstantExpression; // This should be a constant expression if (source == null) { throw new InvalidOperationException(); } table = source.Value as ITable; // Get the the type of the elements of the table Type elementType = TypeHelper.GetElementType(source.Type); // Create context ParameterExpression context = Expression.Parameter(elementType, "context"); using (visitor.CreateVariable(context, commandTree.Target.VariableName)) { // Create the predicate expression LambdaExpression predicateExpression = Expression.Lambda( visitor.Visit(predicate), context); // Create Where expression LinqMethodExpressionBuilder queryMethodBuilder = new LinqMethodExpressionBuilder(); return queryMethodBuilder.Where(source, predicateExpression); } }