Exemplo n.º 1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddDbContext <FootballDbContext>(builder =>
            {
                string connectionString = DbConnectionStrings.Resolve("Firestorm.FootballExample");
                builder.UseSqlServer(connectionString);
            });

            var fsBuilder = services.AddFirestorm()
                            .AddEndpoints(new EndpointConfiguration
            {
                Response =
                {
                    StatusField = ResponseStatusField.StatusCode,
                    Pagination  =
                    {
                        UseLinkHeaders  = true
                    },
                    ShowDeveloperErrors = true
                }
            })
                            .AddEntityFramework <FootballDbContext>();

            _tech.Configure(fsBuilder);
        }
Exemplo n.º 2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddDbContext <MusicDbContext>(builder =>
            {
                string connectionString = DbConnectionStrings.Resolve("Firestorm.MusicExample");
                builder.UseSqlServer(connectionString);
            });

            services.AddFirestorm()
            .AddEndpoints(ExampleConfiguration.EndpointConfiguration)
            .AddStems()
            .Add <ITypeGetter>(new NestedTypeGetter(_config.TestClassType))
            .AddEntityFramework <MusicDbContext>();
        }
Exemplo n.º 3
0
        public ExampleFixture()
        {
            var options = new DbContextOptionsBuilder <ExampleDataContext>()
                          .UseSqlServer(DbConnectionStrings.Resolve("Firestorm.EntityFrameworkCore2Tests"))
                          .Options;

            Context = new ExampleDataContext(options);

            Context.Database.EnsureCreated();

            if (Context.Artists.Any())
            {
                return;
            }

            Context.Artists.AddRange(ExampleDataSets.GetArtists());
            Context.SaveChanges();
        }
Exemplo n.º 4
0
 public ExampleDataContext()
     : base(DbConnectionStrings.Resolve("Firestorm.EntityFramework6Tests"))
 {
 }