예제 #1
0
파일: Program.cs 프로젝트: Ivony/DataPithy
        static void Main(string[] args)
        {
            var services = new ServiceCollection();

            services.AddSingleton <ITest1, TestClass1>();
            services.AddSingleton <ITest, TestClass>();

            var serviceProvider = services.BuildServiceProvider();

            ActivatorUtilities.CreateInstance <TestClass>(serviceProvider);



            var select = new SelectQueryBuilder()
                         .Select(Tables.U.ID, Tables.U.Username, Tables.P.Email)
                         .Where(Tables.U.Age > 30 | Tables.P.Email.Like("*****@*****.**"))
                         .Where(Tables.U.ID != null)
                         .From(Tables.Users.As("U").InnerJoin(Tables.UserProfile.As("P")).On(Tables.U.ID == Tables.P.ID))
                         .Build();

            var insert = new InsertQueryBuilder()
                         .InsertInto(Tables.Users, Names.ID, Names.Username, Names.Email)
                         .WithValues(ValuesClause.Values((1, "Ivony", "*****@*****.**")))
                         .Build();



            var parser = new SqlQueryParser();

            ShowQuery(parser.ParseSelectQuery(select));
            ShowQuery(parser.ParseInsertQuery(insert));

            Console.ReadKey();
        }