Ejemplo n.º 1
0
        public Workspace(string workspaceName, bool openConnection, bool webAppMode)
        {
            if (Lfx.Workspace.Master == null)
            {
                Lfx.Workspace.Master = this;
            }

            this.WebAppMode = webAppMode;
            m_Name          = workspaceName;

            this.CurrentConfig = new Lfx.Config.ConfigManager();

            if (this.WebAppMode == false)
            {
                this.DefaultScheduler = new Lfx.Services.Scheduler(this);
                this.RunTime          = new Lfx.RunTimeServices();
            }

            this.Bootstrap();

            if (openConnection)
            {
                m_MasterConnection.Open();
            }

            // Personalizo los valores de CultureInfo
            this.CultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
            this.CultureInfo.NumberFormat.CurrencyDecimalDigits    = 2;
            this.CultureInfo.NumberFormat.CurrencyGroupSeparator   = "";
            this.CultureInfo.NumberFormat.CurrencySymbol           = "$";

            this.CultureInfo.NumberFormat.NumberDecimalSeparator = ".";
            this.CultureInfo.NumberFormat.NumberGroupSeparator   = "";

            this.CultureInfo.DateTimeFormat.FullDateTimePattern = Lfx.Types.Formatting.DateTime.FullDateTimePattern;
            this.CultureInfo.DateTimeFormat.LongDatePattern     = Lfx.Types.Formatting.DateTime.LongDatePattern;
            this.CultureInfo.DateTimeFormat.ShortDatePattern    = Lfx.Types.Formatting.DateTime.ShortDatePattern;
            this.CultureInfo.DateTimeFormat.ShortTimePattern    = "HH:mm";
            this.CultureInfo.DateTimeFormat.LongTimePattern     = "HH:mm:ss";

            System.Threading.Thread.CurrentThread.CurrentCulture   = this.CultureInfo;
            System.Threading.Thread.CurrentThread.CurrentUICulture = this.CultureInfo;

            this.MetadataFactory = new Lazaro.Orm.Mapping.AnnotationMetadataFactory();
            this.MetadataFactory.ScanFolder(System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location), true);
        }
Ejemplo n.º 2
0
        public Workspace(string workspaceName, bool openConnection, bool webAppMode)
        {
            if (Lfx.Workspace.Master == null)
            {
                Lfx.Workspace.Master = this;
            }

            this.WebAppMode = webAppMode;
            m_Name          = workspaceName;

            this.CurrentConfig = new Lfx.Config.ConfigManager();

            if (this.WebAppMode == false)
            {
                this.DefaultScheduler = new Lfx.Services.Scheduler(this);
                this.RunTime          = new Lfx.RunTimeServices();
            }

            if (m_MasterConnection == null)
            {
                m_MasterConnection = new Lfx.Data.Connection(this, this.Name);
                m_MasterConnection.RequiresTransaction = false;
            }

            if (Lfx.Data.DataBaseCache.DefaultCache == null)
            {
                Lfx.Data.DataBaseCache.DefaultCache = new Lfx.Data.DataBaseCache(m_MasterConnection);
            }

            if (this.MasterConnection.AccessMode == Lfx.Data.AccessModes.Undefined)
            {
                switch (this.CurrentConfig.ReadLocalSettingString("Data", "ConnectionType", "mysql"))
                {
                case "odbc":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.Odbc;
                    break;

                case "myodbc":
                case "mysql":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.MySql;
                    break;

                case "npgsql":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.Npgsql;
                    break;

                case "mssql":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.MSSql;
                    break;

                case "sqlite":
                    Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.SQLite;
                    break;
                }
            }

            if (Lfx.Data.DataBaseCache.DefaultCache.ServerName == null)
            {
                Lfx.Data.DataBaseCache.DefaultCache.ServerName   = this.CurrentConfig.ReadLocalSettingString("Data", "DataSource", "localhost");
                Lfx.Data.DataBaseCache.DefaultCache.DataBaseName = this.CurrentConfig.ReadLocalSettingString("Data", "DatabaseName", "lazaro");
                Lfx.Data.DataBaseCache.DefaultCache.UserName     = this.CurrentConfig.ReadLocalSettingString("Data", "User", "lazaro");
                Lfx.Data.DataBaseCache.DefaultCache.Password     = this.CurrentConfig.ReadLocalSettingString("Data", "Password", string.Empty);
            }

            System.Text.RegularExpressions.Regex IpLocal1 = new System.Text.RegularExpressions.Regex(@"^192\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
            System.Text.RegularExpressions.Regex IpLocal2 = new System.Text.RegularExpressions.Regex(@"^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
            if (Lfx.Data.DataBaseCache.DefaultCache.ServerName.Contains(".") == false || IpLocal1.IsMatch(Lfx.Data.DataBaseCache.DefaultCache.ServerName) || IpLocal2.IsMatch(Lfx.Data.DataBaseCache.DefaultCache.ServerName))
            {
                Lfx.Data.DataBaseCache.DefaultCache.SlowLink = false;
            }
            else
            {
                Lfx.Data.DataBaseCache.DefaultCache.SlowLink = true;
            }

            if (openConnection)
            {
                m_MasterConnection.Open();
            }

            // Personalizo los valores de CultureInfo
            this.CultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
            this.CultureInfo.NumberFormat.CurrencyDecimalDigits    = 2;
            this.CultureInfo.NumberFormat.CurrencyGroupSeparator   = "";
            this.CultureInfo.NumberFormat.CurrencySymbol           = "$";

            this.CultureInfo.NumberFormat.NumberDecimalSeparator = ".";
            this.CultureInfo.NumberFormat.NumberGroupSeparator   = "";

            this.CultureInfo.DateTimeFormat.FullDateTimePattern = Lfx.Types.Formatting.DateTime.FullDateTimePattern;
            this.CultureInfo.DateTimeFormat.LongDatePattern     = Lfx.Types.Formatting.DateTime.LongDatePattern;
            this.CultureInfo.DateTimeFormat.ShortDatePattern    = Lfx.Types.Formatting.DateTime.ShortDatePattern;
            this.CultureInfo.DateTimeFormat.ShortTimePattern    = "HH:mm";
            this.CultureInfo.DateTimeFormat.LongTimePattern     = "HH:mm:ss";

            System.Threading.Thread.CurrentThread.CurrentCulture   = this.CultureInfo;
            System.Threading.Thread.CurrentThread.CurrentUICulture = this.CultureInfo;
        }
Ejemplo n.º 3
0
                public Workspace(string workspaceName, bool openConnection, bool webAppMode)
                {
                        if (Lfx.Workspace.Master == null)
                                Lfx.Workspace.Master = this;

                        this.WebAppMode = webAppMode;
                        m_Name = workspaceName;

                        this.CurrentConfig = new Lfx.Config.ConfigManager();

                        if (this.WebAppMode == false) {
                                this.DefaultScheduler = new Lfx.Services.Scheduler(this);
                                this.RunTime = new Lfx.RunTimeServices();
                        }

                        if (m_MasterConnection == null) {
                                m_MasterConnection = new Lfx.Data.Connection(this, this.Name);
                                m_MasterConnection.RequiresTransaction = false;
                        }

                        if (Lfx.Data.DataBaseCache.DefaultCache == null)
                                Lfx.Data.DataBaseCache.DefaultCache = new Lfx.Data.DataBaseCache(m_MasterConnection);

                        if (this.MasterConnection.AccessMode == Lfx.Data.AccessModes.Undefined) {
                                switch (this.CurrentConfig.ReadLocalSettingString("Data", "ConnectionType", "mysql")) {
                                        case "odbc":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.Odbc;
                                                break;

                                        case "myodbc":
                                        case "mysql":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.MySql;
                                                break;

                                        case "npgsql":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.Npgsql;
                                                break;

                                        case "mssql":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.MSSql;
                                                break;

                                        case "sqlite":
                                                Lfx.Data.DataBaseCache.DefaultCache.AccessMode = Lfx.Data.AccessModes.SQLite;
                                                break;
                                }
                        }

                        if (Lfx.Data.DataBaseCache.DefaultCache.ServerName == null) {
                                Lfx.Data.DataBaseCache.DefaultCache.ServerName = this.CurrentConfig.ReadLocalSettingString("Data", "DataSource", "localhost");
                                Lfx.Data.DataBaseCache.DefaultCache.DataBaseName = this.CurrentConfig.ReadLocalSettingString("Data", "DatabaseName", "lazaro");
                                Lfx.Data.DataBaseCache.DefaultCache.UserName = this.CurrentConfig.ReadLocalSettingString("Data", "User", "lazaro");
                                Lfx.Data.DataBaseCache.DefaultCache.Password = this.CurrentConfig.ReadLocalSettingString("Data", "Password", string.Empty);
                        }

                        System.Text.RegularExpressions.Regex IpLocal1 = new System.Text.RegularExpressions.Regex(@"^192\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
                        System.Text.RegularExpressions.Regex IpLocal2 = new System.Text.RegularExpressions.Regex(@"^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
                        if (Lfx.Data.DataBaseCache.DefaultCache.ServerName.Contains(".") == false || IpLocal1.IsMatch(Lfx.Data.DataBaseCache.DefaultCache.ServerName) || IpLocal2.IsMatch(Lfx.Data.DataBaseCache.DefaultCache.ServerName)) {
                                Lfx.Data.DataBaseCache.DefaultCache.SlowLink = false;
                        } else {
                                Lfx.Data.DataBaseCache.DefaultCache.SlowLink = true;
                        }

                        if (openConnection)
                                m_MasterConnection.Open();

                        // Personalizo los valores de CultureInfo
                        this.CultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
                        this.CultureInfo.NumberFormat.CurrencyDecimalDigits = 2;
                        this.CultureInfo.NumberFormat.CurrencyGroupSeparator = "";
                        this.CultureInfo.NumberFormat.CurrencySymbol = "$";

                        this.CultureInfo.NumberFormat.NumberDecimalSeparator = ".";
                        this.CultureInfo.NumberFormat.NumberGroupSeparator = "";

                        this.CultureInfo.DateTimeFormat.FullDateTimePattern = Lfx.Types.Formatting.DateTime.FullDateTimePattern;
                        this.CultureInfo.DateTimeFormat.LongDatePattern = Lfx.Types.Formatting.DateTime.LongDatePattern;
                        this.CultureInfo.DateTimeFormat.ShortDatePattern = Lfx.Types.Formatting.DateTime.ShortDatePattern;
                        this.CultureInfo.DateTimeFormat.ShortTimePattern = "HH:mm";
                        this.CultureInfo.DateTimeFormat.LongTimePattern = "HH:mm:ss";

                        System.Threading.Thread.CurrentThread.CurrentCulture = this.CultureInfo;
                        System.Threading.Thread.CurrentThread.CurrentUICulture = this.CultureInfo;
                }