Beispiel #1
0
        public static List <DbConfigDatabaseInfo> GetZeroDbConfigDatabaseInfoByEntityFullName(string entityFullName)
        {
            if (string.IsNullOrEmpty(entityFullName))
            {
                return(null);
            }
            var zeroConfigInfo = DbConfigReader.GetZeroDbConfigInfo();

            if (zeroConfigInfo != null && zeroConfigInfo.Dbs != null && zeroConfigInfo.Dvs.Count > 0)
            {
                var entityKey = entityFullName;
                var info1     = zeroConfigInfo.Dvs.FindAll(o => string.Equals(o.entityKey, entityKey, StringComparison.OrdinalIgnoreCase));
                if (info1 == null || info1.Count < 1)
                {
                    return(null);
                }
                var dbKeys = info1.Select(o => o.dbKey).Distinct().ToArray();
                var reval  = new List <DbConfigDatabaseInfo>();
                foreach (var dbKey in dbKeys)
                {
                    var db = zeroConfigInfo.Dbs.Find(o => string.Equals(o.dbKey, dbKey, StringComparison.OrdinalIgnoreCase));
                    if (db != null)
                    {
                        reval.Add(db);
                    }
                }
                return(reval);
            }
            return(null);
        }
Beispiel #2
0
        public static DbConfigDatabaseInfo GetZeroDbConfigDatabaseInfo(string dbKey)
        {
            var zeroConfigInfo = DbConfigReader.GetZeroDbConfigInfo();

            if (zeroConfigInfo != null && zeroConfigInfo.Dbs != null && zeroConfigInfo.Dbs.Count > 0)
            {
                return(zeroConfigInfo.Dbs.Find(o => string.Equals(o.dbKey, dbKey, StringComparison.OrdinalIgnoreCase)));
            }
            return(null);
        }
Beispiel #3
0
        public static List <DbConfigDataviewInfo> GetDbConfigDataViewInfo <T>()
        {
            var zeroConfigInfo = DbConfigReader.GetZeroDbConfigInfo();

            if (zeroConfigInfo != null && zeroConfigInfo.Dbs != null && zeroConfigInfo.Dvs.Count > 0)
            {
                var entityKey = typeof(T).FullName;
                var info1     = zeroConfigInfo.Dvs.FindAll(o => string.Equals(o.entityKey, entityKey, StringComparison.OrdinalIgnoreCase));
                return(info1);
            }
            return(null);
        }
Beispiel #4
0
        public static bool IsStandardMapping <T>()
        {
            var zeroConfigInfo = DbConfigReader.GetZeroDbConfigInfo();

            if (zeroConfigInfo != null && zeroConfigInfo.Dbs != null && zeroConfigInfo.Dvs.Count > 0)
            {
                var entityKey = typeof(T).FullName;
                var info1     = zeroConfigInfo.Dvs.Find(o => string.Equals(o.entityKey, entityKey, StringComparison.OrdinalIgnoreCase));
                if (info1 == null)
                {
                    return(false);
                }
                return(info1.isStandardMapping);
            }
            return(false);
        }
Beispiel #5
0
 public bool AddZeroDbMapping(string entityFullName, string dbKey, string tableName)
 {
     return(DbConfigReader.AddZeroDbMapping(entityFullName, dbKey, tableName));
 }