Exemplo n.º 1
0
        public SupplyDataContext CreateDbContext(string[] args)
        {
            var settings = new SupplyDataContextSettings
            {
                ConnectionString = @"data source=localhost,1433;initial catalog=SupplyContext;
                    integrated security=False;User Id=sa; Password=SuperS3cretPassw0rd; 
                    MultipleActiveResultSets=True;App=SupplyContext;Packet size=1500"
            };

            return(new SupplyDataContext(settings));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var config = BuildConfiguration();

            var dbSettings = new SupplyDataContextSettings
            {
                ConnectionString = config.GetConnectionString("SqlDataConnection")
            };

            var provider = new ServiceCollection()
                           .AddEfSupplyContext(dbSettings).BuildServiceProvider();

            var repo = provider.GetService <IInvoceRepository>();

            //=====

            var goods = new[]
            {
                GoodNumber.Parse("G4"),
                GoodNumber.Parse("G2"),
                GoodNumber.Parse("G6"),
                GoodNumber.Parse("G6"),
                GoodNumber.Parse("G6")
            };

            var invoce = new Invoce("34h-334", "AAA-2", goods);

            var invoceList = new InvoceList(
                InvoiceBarCode.Parse("CodeBI-1"),
                FileKey.Parse("FK-1")
                );

            invoce.WhenListBeScan(invoceList);

            repo.Save(invoce);

            var invoces = repo.Query(0, 10, null);
        }
 public SupplyContextFactory(SupplyDataContextSettings settings)
 {
     _settings = settings;
 }