Exemple #1
0
        public ActionResult Index()
        {
            using (_log.StartTiming(false, "HomeController - Load Index Page").WithWarning(10000))
            {
                var model = new HomeViewModel();

                OrmLiteProfileView view;
                using (_log.StartTiming(false, "HomeController - Index Create View").WithWarning(5000))
                {
                    var connectionString =
                        ConfigurationManager.ConnectionStrings[ApplicationManager.DatabaseConnectionStringName]
                        .ConnectionString;

                    var dialect = new CustomSqlServerOrmLiteDialectProvider();
                    OrmLiteConfig.DialectProvider = dialect;

                    var dbFactory = new OrmLiteConnectionFactory(connectionString, dialect);

                    var db = dbFactory.Open();

                    view = new OrmLiteProfileView(db);
                }

                using (_log.StartTiming(false, "HomeController - Index View GetLatest").WithWarning(5000))
                {
                    model.Profiles = view.GetLatestSummaries(21);
                }

                var views = ApplicationManager.BuildViews();

                model.ChartTypes = views.ChartTypes.GetAll();

                return(View(model));
            }
        }
Exemple #2
0
        public static IDbConnection OpenConnection()
        {
            var connectionString = ConfigurationManager.ConnectionStrings["AltidudeConnection"].ConnectionString;

            var dialect = new CustomSqlServerOrmLiteDialectProvider();

            OrmLiteConfig.DialectProvider = dialect;

            var dbFactory = new OrmLiteConnectionFactory(connectionString, dialect);

            return(dbFactory.Open());
        }
Exemple #3
0
        private string GenerateCreateScript(params Type[] types)
        {
            string createScript = string.Empty;

            var dialect = new CustomSqlServerOrmLiteDialectProvider();

            //var dialect = SqlServerDialect.Provider;

            OrmLiteConfig.DialectProvider = dialect;

            foreach (var type in types)
            {
                if (createScript != string.Empty)
                {
                    createScript += "\r\n\r\n";
                }

                createScript += dialect.ToCreateTableStatement(type);
            }

            return(createScript);
        }