public static ShamanOptions GetShamanOptions()
 {
     return(ShamanOptions.GetDefault(typeof(SingularTableNamesDbContext))
            .With(new RemovePluralizingTableNameService())
            .WithLogger(new MethodCallLogger(
                            LogToConsoleWhileMigrationService.LogInfoToConsole,
                            LogToConsoleWhileMigrationService.LogExceptionToConsole
                            )));
 }
 public static ShamanOptions GetShamanOptions()
 {
     return(ShamanOptions.GetDefault <UnicodeTestDbContext>()
            .With(new RemovePluralizingTableNameService())
            .WithSqlServer()
            .WithLogger(new MethodCallLogger(
                            LogToConsoleWhileMigrationService.LogInfoToConsole,
                            LogToConsoleWhileMigrationService.LogExceptionToConsole
                            )));
 }
예제 #3
0
        public static ShamanOptions GetShamanOptions(Type dbContextType)
        {
            var options = ShamanOptions.GetDefault(dbContextType)
                          // .WithLogger(new MethodCallLogger(WriteDebugInfo))
                          .WithSqlServer();

            //.With<LogToConsoleWhileMigrationService>()
            //.With<SqlDbContextValueProvider>();
            // return ShamanOptions.Default.With(new PrefixedTableNameService("myPrefix"));
            return(options);
        }
예제 #4
0
        public void ModifyShamanOptions(ShamanOptions options)
        {
            var callerInfo = ShamanCallstackSpy.CallerInfo;

            if (callerInfo != CallerInfoType.AddMigration && callerInfo != CallerInfoType.RemoveMigration)
            {
                return;
            }
            var consoleLogger = new MethodCallLogger(LogInfoToConsole);
            var message       = callerInfo == CallerInfoType.AddMigration
                ? "Running under add-migration"
                : "Running under remove-migration";

            consoleLogger.Log(typeof(LogToConsoleWhileMigrationService), nameof(ModifyShamanOptions), message);
            options.WithLogger(options.Logger.Append(consoleLogger));
        }
        public void ModifyShamanOptions([NotNull] ShamanOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            var callerInfo = ShamanCallstackSpy.GetCallerInfo(options.Logger);

            if (callerInfo != CallerInfoType.AddMigration && callerInfo != CallerInfoType.RemoveMigration)
            {
                return;
            }
            var consoleLogger = new MethodCallLogger(LogInfoToConsole, LogExceptionToConsole);
            var message       = callerInfo == CallerInfoType.AddMigration
                ? "Running under add-migration"
                : "Running under remove-migration";

            consoleLogger.Log(typeof(LogToConsoleWhileMigrationService), nameof(ModifyShamanOptions), message);
            options.WithLogger(options.Logger.Append(consoleLogger));
        }
예제 #6
0
 public static ModelInfo Make <T>(ShamanOptions options = null)
 {
     return(new ModelInfo(typeof(T), options));
 }
예제 #7
0
 private static ShamanOptions GetShamanOptions()
 {
     return(ShamanOptions
            .GetDefault(typeof(TestDbContext))
            .With <EmptyService>());
 }
예제 #8
0
        internal static ModelInfo GetModelInfo <T>(ShamanOptions options = null)
        {
            var aa = new ModelInfo(typeof(T), options);

            return(aa);
        }
예제 #9
0
 public ModelInfo(Type dbContextType, IList <IShamanService> services = null)
 {
     _dbContextType = dbContextType;
     UsedServices   = services ?? ShamanOptions.CreateShamanOptions(dbContextType).Services;
     Prepare();
 }