예제 #1
0
        protected void Application_Start()
        {
            // Syncfusion
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(""); // !!!

            // Autofac
            AppDIAutofacHelper.Setup(new ContainerBuilder());

            AreaRegistration.RegisterAllAreas();

            // Dependency Injection
            // ASP.NET MVC
            // ASP.NET Web API + Syncfusion Report Viewer
            GlobalConfiguration.Configure(WebApiConfig.Register);

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            RouteConfig.RegisterRoutes(RouteTable.Routes);

            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Json.NET
            JsonConvert.DefaultSettings = () => AppHelper.JsonSettings;

            // NHibernate
            //GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new NHibernateContractResolver();

            // Razor
            ViewEngines.Engines.Clear();
            //ViewEngines.Engines.Add(new RazorViewEngine());
            ViewEngines.Engines.Add(new CustomRazorViewEngine());

            // Validation
            // /App_GlobalResources/ValidationResources.*.resx

            ClientDataTypeModelValidatorProvider.ResourceClassKey = "ValidationResources";
            DefaultModelBinder.ResourceClassKey = "ValidationResources";

#if DEBUG
            // EF 6.0 Log
            //DbInterception.Add(new NLogCommandInterceptor()); // Entity Framework
#endif
        }
예제 #2
0
        static void Main(string[] args)
        {
            // Autofac
            AppDIAutofacHelper.Setup(new ContainerBuilder());
            // Unity
            //AppDIUnityHelper.Setup(new UnityContainer());

            MultiTenantHelper.Setup("MyLOB");

            // EF 6.0 Log
            //ILogManager logManager = DIHelper.DIManager.GetService<ILogManager>();
            //DbInterception.Add(new NLogCommandInterceptor(logManager));

            bool exit = false;

            while (!exit)
            {
                Console.Clear();
                Console.WriteLine("EasyLOB Shell\n");
                Console.WriteLine("<0> EXIT");
                Console.WriteLine("<1> Application Demo");
                Console.WriteLine("<2> Persistence Demo");
                Console.WriteLine("<3> AutoMapper Demo");
                Console.WriteLine("<4> CRUD Demo");
                Console.WriteLine("<5> LINQ Demo");
                Console.WriteLine("<6> EDM Demo");
                Console.WriteLine("<7> Demo");
                Console.Write("\nChoose an option... ");

                ConsoleKeyInfo key = Console.ReadKey();
                Console.WriteLine();

                switch (key.KeyChar) // <ENTER> = '\r'
                {
                case ('0'):
                    exit = true;
                    break;

                case ('1'):
                    ApplicationDemo();
                    break;

                case ('2'):
                    PersistenceDemo();
                    break;

                case ('3'):
                    AutoMapperDemo();
                    break;

                case ('4'):
                    CRUDDemo();
                    break;

                case ('5'):
                    LINQDemo();
                    break;

                case ('6'):
                    EDMDemo();
                    break;

                case ('7'):
                    Demo();
                    break;
                }

                //if (!exit)
                //{
                //    Console.Write("\nPress <KEY> to continue... ");
                //    Console.ReadKey();
                //}
            }
        }