Example #1
0
        static void Create()
        {
            var factory = new SampleContextFactory();

            Smart.Default.AddExtensions(
                new AnnotationListFormatter(),
                new ServicePropertiesFormatter(),
                new PropertyListFormatter(),
                new ForeignKeyListFormatter(),
                new KeyListFormatter(),
                new EntityNamespaceListFormatter(),
                new EntityListFormatter(),
                new IndexListFormatter(),
                new LambdaExpressionFormatter(),
                new ModelNamespaceListFormatter(),
                new ForeignKeyNamespaceListFormatter(),
                new NavigationFormatter(),
                new NavigationNamespaceListFormatter());

            Directory.CreateDirectory("./MainFolder");

            Stopwatch sw = new Stopwatch();

            sw.Start();
            using (var context = factory.CreateDbContext(null))
            {
                IModel model = context.Model;
                sw.Stop();
                Console.WriteLine("{0} milliseconds has been elapsed for creating Model", sw.Elapsed.TotalMilliseconds);

                sw.Restart();

                var v = new ModelCompiler(model, "test", "./MainFolder");
                v.createModel();

                sw.Stop();
                Console.WriteLine("{0} milliseconds has been elapsed for creating Compiled Model", sw.Elapsed.TotalMilliseconds);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            var context = new SampleContextFactory().Create();

            var ketchup =
                KetchupBuilder
                    .Configure(() => new EntityFrameworkPersistenceManager(context))
                    .AsProductManager()
                    .Build();

            var categories = ketchup.Products.GetProductCategories();

            foreach (var productCategory in categories)
            {
                Console.WriteLine("Category: {0}", productCategory.Name);

                foreach (var attribute in productCategory.Specification)
                {
                    Console.WriteLine(attribute.Attribute.Name);
                }
            }

            Console.ReadLine();
        }