Beispiel #1
0
        public static IEnumerable <string> LoadSqlServerInstances(bool onlyLocal = true)
        {
            if (onlyLocal)
            {
                return(LoadLocalSqlServerInstances());
            }

            var _table = SqlDataSourceEnumerator.Instance.GetDataSources();

            var _rows = _table.Rows.Cast <DataRow>().ToArray();

            _rows = _rows.Where(row => !DeVesValidator.IsNullState(row["ServerName"]) && !DeVesValidator.IsNullState(row["InstanceName"])).ToArray();

            var _instances = _rows.Select(row => string.Format("{0}\\{1}", row["ServerName"], row["InstanceName"]));

            DeVesHelper.DisposeDataTable(ref _table);

            return(_instances);
        }
Beispiel #2
0
        public static TValue To <TValue>(object value)
        {
            var _defaultValue = DeVesHelper.GetDefaultValue <TValue>();

            return(DeVesConverter.To(value, _defaultValue));
        }
Beispiel #3
0
 public static TValue GetDefaultValue <TValue>()
 {
     return((TValue)DeVesHelper.GetDefaultValue(typeof(TValue)));
 }