public JogosDatabase(MysqlConfiguration mysqlConfiguration) { _builder = new MySqlConnectionStringBuilder { UserID = mysqlConfiguration.UserID, Password = mysqlConfiguration.Password, Server = mysqlConfiguration.Server, Database = mysqlConfiguration.Database, }; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var builder = new MysqlConfiguration(); Configuration.GetSection("database").Bind(builder); services.AddSingleton(builder); services.AddTransient <IUsuarios, UsuariosDatabase>(); services.AddTransient <IJogos, JogosDatabase>(); services.AddTransient <IJogadas, JogadasDatabase>(); services.AddSingleton <UsuariosBusiness>(); services.AddSingleton <UsuariosFacade>(); services.AddSingleton <JogosBusiness>(); services.AddSingleton <JogosFacade>(); services.AddSingleton <JogadasBusiness>(); services.AddSingleton <JogadaFacade>(); services.AddCors(); // Make sure you call this previous to AddMvc services.AddControllers(); services.AddControllersWithViews() .AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore ); }