Пример #1
0
        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();
        }