Example #1
0
        private IDbContext CreateDbContext(IDbContext ctx)
        {
            connection.StateChange += new StateChangeEventHandler(connection_StateChange);
            if (!(connection is DbConnectionWrapper))
            {
                switch (DbProviderName)
                {
                case DbProviderNames.Oracle_ODP:
                    connection = new ODPConnectionWrapper(this, connection);
                    break;

                case DbProviderNames.Oracle_Managed_ODP:
                case DbProviderNames.Uql_Data_Oracle:
                    connection = new ManagedODPConnectionWrapper(this, connection);
                    break;

                case DbProviderNames.SQLite:
                    connection = new DbConnectionWrapper(this, connection)
                    {
                        IsFileDatabase = true
                    };
                    break;

                case DbProviderNames.SqlCe40:
                case DbProviderNames.SqlCe35:
                case DbProviderNames.Oledb:
                    connection = new DbConnectionWrapper(this, connection)
                    {
                        IsFileDatabase = true
                    };
                    break;

                default:
                    connection = new DbConnectionWrapper(this, connection);
                    break;
                }
            }

            ctx = new InternalDbContext(this, connection);
            return(ctx);
        }
 public static Expression Include(IDbExpressionBuilder dbExpressionBuilder, InternalDbContext policy, Expression expression)
 {
     return(new RelationshipIncluder(dbExpressionBuilder, policy).Visit(expression));
 }
 private RelationshipIncluder(IDbExpressionBuilder dbExpressionBuilder, InternalDbContext policy)
 {
     this.dbExpressionBuilder = dbExpressionBuilder;
     this.policy = policy;
 }