コード例 #1
0
ファイル: DataContext.cs プロジェクト: mrayburn/Highway.Data
 /// <summary>
 /// Constructs a context
 /// </summary>
 /// <param name="connectionString">The standard SQL connection string for the Database</param>
 /// <param name="mapping">The Mapping Configuration that will determine how the tables and objects interact</param>
 /// <param name="contextConfiguration">The context specific configuration that will change context level behavior</param>
 /// <param name="log">The logger being supplied for this context ( Optional )</param>
 public DataContext(string connectionString, IMappingConfiguration mapping,
                    IContextConfiguration contextConfiguration, ILog log)
     : base(connectionString)
 {
     _mapping = mapping;
     _log     = log;
     if (contextConfiguration != null)
     {
         contextConfiguration.ConfigureContext(this);
     }
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataContext"/> class.
 /// </summary>
 /// <param name="dbConnection">The db connection.</param>
 /// <param name="contextOwnsConnection">The context owns connection.</param>
 /// <param name="mapping">The Mapping Configuration that will determine how the tables and objects interact</param>
 /// <param name="contextConfiguration">The context specific configuration that will change context level behavior</param>
 /// <param name="log">The logger being supplied for this context ( Optional )</param>
 public DataContext(
     DbConnection dbConnection,
     bool contextOwnsConnection,
     IMappingConfiguration mapping,
     IContextConfiguration contextConfiguration,
     ILog log) : base(dbConnection, contextOwnsConnection)
 {
     this._mapping     = mapping;
     this._log         = log;
     this.Database.Log = _log.Debug;
     if (contextConfiguration != null)
     {
         contextConfiguration.ConfigureContext(this);
     }
 }