Exemple #1
0
        //public static ServiceDBConfigurationEntityFramework SetOption<TContext>( this ServiceDBConfigurationEntityFramework value,  Action<DbContextOptionsBuilder> optionsAction = null, ServiceLifetime contextLifetime = ServiceLifetime.Scoped) where TContext : DbContext;

        //public static ServiceDBConfigurationEntityFramework SetOption<TContext>( this ServiceDBConfigurationEntityFramework value, ServiceLifetime contextLifetime) where TContext : DbContext;

        //public static ServiceDBConfigurationEntityFramework SetOption<TContext>( this ServiceDBConfigurationEntityFramework value,  Action<IServiceProvider, DbContextOptionsBuilder> optionsAction, ServiceLifetime contextLifetime = ServiceLifetime.Scoped) where TContext : DbContext;

        public static OracleServiceDBConfiguration SetOption(this OracleServiceDBConfiguration value, Func <DbContextOptionsBuilder, DbContextOptionsBuilder> function)
        {
            DbContextOptionsBuilder builder = new DbContextOptionsBuilder <OracleService>();

            builder       = function(builder);
            value.Options = builder.Options;
            return(value);
        }
Exemple #2
0
        public static OracleServiceDBConfiguration SetConnectionString(string ConnectionString)
        {
            var value = new OracleServiceDBConfiguration();

            value.ConnectionString = ConnectionString;

            ServicesContainer.AddSingleton <OracleServiceDBConfiguration>(value);

            ServicesContainer.AddTransient <OracleService>();

            return(value);
        }
Exemple #3
0
        public OracleService() : base(ServicesContainer.GetService <OracleServiceDBConfiguration>().Options)
        {
            Options = ServicesContainer.GetService <OracleServiceDBConfiguration>();

            var method = this.GetType().GetMethod("Set");

            var result = Options.Assembly.GetTypes().Where(x => x.GetInterface("IEntityOracle", true) != null);

            foreach (var item in result)
            {
                var db = method.MakeGenericMethod(item).Invoke(this, null);
                DbSetCollection.Add(item, db);
            }
        }
Exemple #4
0
 public static OracleServiceDBConfiguration SetAssembly(this OracleServiceDBConfiguration value, Assembly assembly)
 {
     value.Assembly = assembly;
     return(value);
 }
Exemple #5
0
 public static OracleServiceDBConfiguration SetOption(this OracleServiceDBConfiguration value, DbContextOptions option)
 {
     value.Options = option;
     return(value);
 }