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
                            )));
 }
Exemple #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);
        }
Exemple #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));
        }
Exemple #6
0
 public static ModelInfo Make <T>(ShamanOptions options = null)
 {
     return(new ModelInfo(typeof(T), options));
 }
 private static ShamanOptions GetShamanOptions()
 {
     return(ShamanOptions
            .GetDefault(typeof(TestDbContext))
            .With <EmptyService>());
 }
        internal static ModelInfo GetModelInfo <T>(ShamanOptions options = null)
        {
            var aa = new ModelInfo(typeof(T), options);

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