// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddTransient <ListItemReader, ListItemReader>(); services.AddTransient <ListItemCreator, ListItemCreator>(); services.AddTransient <ListItemChecker, ListItemChecker>(); // var connectionString = Configuration.GetConnectionString("ToDoListDatabase"); // services.AddDbContext<ToDoListContext>(options => // options.UseSqlServer(connectionString)); // // services.AddTransient<IListItemStorageSaver, DbStorage>(); // services.AddTransient<IListItemStorageReader, DbStorage>(); // services.AddTransient<IListItemStorageChanger, DbStorage>(); var fakeStorage = new FakeStorage(); services.AddSingleton <IListItemStorageSaver, FakeStorage>((serviceCollection) => fakeStorage); services.AddSingleton <IListItemStorageReader, FakeStorage>((serviceCollection) => fakeStorage); services.AddSingleton <IListItemStorageChanger, FakeStorage>((serviceCollection) => fakeStorage); services.AddCors(o => o.AddPolicy("MyPolicy", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); }
/// <summary> /// Initializes a new instance of the <see cref="CsvEntityRegistry"/>. /// </summary> public CsvEntityRegistry(string path) { if (path == null) { throw new ArgumentNullException(nameof(path)); } Path = path; Storage = new FakeStorage(this); _exchanges = new ExchangeCsvList(this); _exchangeBoards = new ExchangeBoardCsvList(this); _securities = new SecurityCsvList(this); _portfolios = new PortfolioCsvList(this); _positions = new PositionCsvList(this); }
static void Main(string[] args) { IConfigurationProvider provider = new MapperConfiguration(conf => conf.AddProfile(new MapperProfile())); IMapper mapper = provider.CreateMapper(); IEnumerable <UserSource> user = FakeStorage.GetUsers(); IList <UserTarget> usertarget = mapper.Map <IList <UserTarget> >(user); foreach (var item in usertarget) { Console.WriteLine($"element nr.: {usertarget.IndexOf(item)}"); Console.WriteLine(item.Print()); } Console.ReadLine(); }