Ejemplo n.º 1
0
        public static CrudlessInitializer UseEntityFramework(this CrudlessInitializer initializer, Type dbContextFactoryType = null)
        {
            Type contextFactoryType = dbContextFactoryType ?? typeof(DiDbContextFactory);

            if (!typeof(DbContextFactory).IsAssignableFrom(contextFactoryType))
            {
                throw new ArgumentException($"'{contextFactoryType}' does not inherit DbContextFactory", nameof(dbContextFactoryType));
            }

            return(initializer.AddInitializer(new EntityFrameworkCoreInitializer(contextFactoryType)));
        }
        public static CrudlessInitializer UseTransactions(this CrudlessInitializer initializer,
                                                          TransactionType transactionType = TransactionType.Auto)
        {
            if (transactionType == TransactionType.Auto)
            {
                transactionType = initializer.Supports("EntityFramework")
                    ? TransactionType.EntityFramework
                    : TransactionType.TransactionScope;
            }

            return(initializer.AddInitializer(new TransactionInitializer(transactionType)));
        }
 public static CrudlessInitializer UseTurnerMediatorAdapter(this CrudlessInitializer initializer)
 {
     return(initializer.AddInitializer(new TurnerMediatorAdapterInitializer()));
 }
 public static CrudlessInitializer UseFluentValidation(this CrudlessInitializer initializer)
 {
     return(initializer.AddInitializer(new FluentValidationInitializer()));
 }