示例#1
0
文件: Program.cs 项目: Pondidum/Ambry
        static void Main(string[] args)
        {
            try
            {
                var factory = DbProviderFactories.GetFactory("MySql.Data.MySqlClient");

                var store = new Store(factory, ConnectionString);
                var builder = new StoreBuilder(factory, ConnectionString, new MySqlProvider());

                //builder.CreateTable<TypesRecord>();
                builder.CreateIndex<TypesRecord>(x => x.Name);
                //builder.CreateIndex<TypesRecord>(x => x.Age);
                //builder.CreateIndex<TypesRecord>(x => x.DateOfBirth);

                var test = new TypesRecord
                            {
                                Age = 1337,
                                DateOfBirth = new DateTime(2011, 10, 09, 08, 07, 6),
                                Name = "Testing"
                            };

                store.Save(test);
                store.GetByProperty<TypesRecord>(x => x.Age, 21);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex);
            }

            System.Console.WriteLine("Done.");
            System.Console.ReadKey();
        }