// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <ApplicationUser, IdentityRole>() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); // Add application services. services.AddTransient <IEmailSender, EmailSender>(); services.AddMvc(); services.AddSingleton(MapperCfg.Initialize()); services.AddScoped <IHotDogService, HotDogService>(); services.AddScoped <IRepo, Repo.Repos>(); }
/// <summary> /// Generates xml element containing the settings. /// </summary> /// <param name="rootElemName">Name to be used as a name of the root element.</param> /// <param name="suppressDefaults">Specifies whether to ommit optional nodes having set default values</param> /// <returns>XElement containing the settings</returns> public override XElement GetXml(string rootElemName, bool suppressDefaults) { XElement rootElem = new XElement(rootElemName); if (!suppressDefaults || !IsDefaultRandomizerSeek) { rootElem.Add(new XAttribute("randomizerSeek", RandomizerSeek.ToString(CultureInfo.InvariantCulture))); } if (NeuralPreprocessorCfg != null) { rootElem.Add(NeuralPreprocessorCfg.GetXml(suppressDefaults)); } rootElem.Add(ReadoutLayerCfg.GetXml(suppressDefaults)); if (MapperCfg != null) { rootElem.Add(MapperCfg.GetXml(suppressDefaults)); } Validate(rootElem, XsdTypeName); return(rootElem); }
// we may consider changing argument type from ICollection to specific 'Settings' class // to be sure that there are not ambiguity during DI resolving public UserDataLogger(ICollection <IUserDataLogStorage> logStorages) { _logStorages = logStorages ?? new List <IUserDataLogStorage>(); mapper = MapperCfg.CreateMapper(); }