Exemple #1
0
        public void Dispose()
        {
            if (this.CqsCommandContext != null)
            {
                this.CqsCommandContext.Dispose();
                this.CqsCommandContext = null;
            }

            GC.SuppressFinalize(this);
        }
Exemple #2
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Creating Cqs Database...");
            using (var cqsContext = new CqsCommandContext())
            {
                var customer = cqsContext.Customers.FirstOrDefault();
            }

            Console.WriteLine("Created Cqs Database...");


            var dapperConnectionFactory = new DapperConnectionFactory(new ConnectionStringProvider()
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["CqsContext"].ConnectionString
            });

            using (var dapperConnection = dapperConnectionFactory.CreateConnection())
            {
                dapperConnection.Open();
                Console.WriteLine("Adding Sprocs into the Cqs Database...");

                dapperConnection.Execute(BuildDropSproc("usp_Read_Customer"));
                dapperConnection.Execute(BuildDropSproc("usp_Read_Order"));
                dapperConnection.Execute(BuildSproc("usp_Read_Customer"));
                dapperConnection.Execute(BuildSproc("usp_Read_Order"));

                Console.WriteLine("Inserting data into the Cqs Database...");

                dapperConnection.Execute(BuildInsertCustomersSql("Joe", "Bloggs", "*****@*****.**"));
                var customerId = dapperConnection.Query <int>(BuildInsertCustomersSql("Sean", "Rogers", "*****@*****.**"))
                                 .First();

                AddOrdersToCustomer(dapperConnection, customerId);
            }

            Console.WriteLine("Database successfully created and seeded.");

            Console.ReadLine();
        }
Exemple #3
0
 public EfUnitOfWork(CqsCommandContext cqsCommandContextcontext)
 {
     this.CqsCommandContext = cqsCommandContextcontext;
 }