// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDbContext <UsuarioContexto>(options => options.UseSqlServer(SqlServerFactory.Create().getConnection())); services.AddDefaultIdentity <IdentityUser>().AddRoles <IdentityRole>() .AddEntityFrameworkStores <UsuarioContexto>() .AddDefaultTokenProviders(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddCors(); services.AddAuthentication(options => { options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; }); services.AddTransient <IEmailSender, AuthMessageSender>(); }
static void Main(string[] args) { /* Aqui vamos instanciar a nossa sql factory */ DbFactory sqlFactory = new SqlServerFactory(); DbConnection sqlConnection = sqlFactory.CreateConnection(); sqlConnection.Open(); DbCommand sqlCommand = sqlFactory.CreateCommand(); sqlCommand.Execute(); /* Aqui vamos instanciar a nossa mongo factory */ DbFactory mongoFactory = new MongoDbFactory(); DbConnection mongoConnection = mongoFactory.CreateConnection(); mongoConnection.Open(); DbCommand mongoCommand = mongoFactory.CreateCommand(); mongoCommand.Execute(); Console.ReadLine(); }
public void Test([DataContexts( ProviderName.DB2, ProviderName.Informix, ExcludeLinqService = true)] string context) { SqlServerFactory.ResolveSqlTypes(""); using (var conn = new DataConnection(context)) { var sp = conn.DataProvider.GetSchemaProvider(); var dbSchema = sp.GetSchema(conn); dbSchema.Tables.ToDictionary( t => t.IsDefaultSchema ? t.TableName : t.SchemaName + "." + t.TableName, t => t.Columns.ToDictionary(c => c.ColumnName)); var table = dbSchema.Tables.SingleOrDefault(t => t.TableName.ToLower() == "parent"); Assert.That(table, Is.Not.Null); Assert.That(table.Columns.Count, Is.EqualTo(2)); // Assert.That(dbSchema.Tables.Single(t => t.TableName.ToLower() == "doctor").ForeignKeys.Count, Is.EqualTo(1)); } }
private ServicoFactory(IsolationLevel isolationLevel) { sqlBase = SqlServerFactory.Create(); this.isolationLevel = isolationLevel; }