public void ConfigureServices(IServiceCollection services) { // инициируем базу данных InitialDatabase.Local(); // добавляем возможность кроссдоменных запросов services.AddCors(options => options.AddPolicy("AlowAll", builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod())); // добавляем проверку запроса и устанавливаем параметры сериализации классов в запросах и ответах services.AddControllers(options => { options.Filters.Add(typeof(ValidatorActionFilter)); }) .AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver()) .SetCompatibilityVersion(CompatibilityVersion.Version_3_0); }
public virtual void Setup() { var options = new DbContextOptionsBuilder <InitialDatabase>() .UseInMemoryDatabase(databaseName: "Initial_Api") .Options; DbContext = new InitialDatabase(options) { IsTest = true }; DbContext.Seed(); AppSettings = AppSettings.Default; AccountService = new AccountService(new AccountRepository(DbContext), AppSettings); AccountService.IsValid(CryptoHelper.Guid("U$1"), out AccountTicket accountTicket); AccountTicket = accountTicket; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddMediatR(Assembly.GetExecutingAssembly()); services.AddMvc( config => config.ModelBinderProviders.Insert(0, new TelegramBotBinderProvider()) ); var http = new HttpClient(); var bot = new TelegramBotClient("Api Token", http); services.AddSingleton(http); services.AddSingleton(bot); Task.Run(async() => { await bot.SetWebhookAsync("https://5c11946c.ngrok.io/api/update"); }); InitialDatabase.Init(); }
public AreaRepository(InitialDatabase database) : base(database) { }
public CustomerRepository(InitialDatabase database) : base(database) { }
public GroupRepository(InitialDatabase database) : base(database) { }
public static void Main() { // заполняем начальными данными InitialDatabase.LocalData(); }
public PrivateRepository(InitialDatabase database) { _database = database; }
public AccountRepository(InitialDatabase database) : base(database) { }
public EnterpriseRepository(InitialDatabase database) : base(database) { }
public Repository(InitialDatabase database) { _database = database; }