Beispiel #1
0
        private void Reorganize()
        {
            if (!isReorganize)
            {
                lock (_syncObj)
                {
                    if (isReorganize)
                    {
                        return;
                    }

                    _increment = (DbIncrementMetaPropertyInfo)GetProperties().FirstOrDefault(x => x is DbIncrementMetaPropertyInfo);

                    var keyList = new List <string>();
                    foreach (var property in GetProperties())
                    {
                        if (property is DbMetaPropertyInfo && ((DbMetaPropertyInfo)property).IsKey)
                        {
                            keyList.Add(((DbMetaPropertyInfo)property).PropertyName);
                        }
                    }
                    _keys = keyList.ToArray();

                    isReorganize = true;
                }
            }
        }
Beispiel #2
0
 public DynamicEntity(string tableName, string[] keys, string incrementColumn, string incrementName)
     : this()
 {
     _tableName = tableName;
     _keys      = keys ?? new string[0];
     if (!string.IsNullOrEmpty(incrementColumn))
     {
         _increment = new DbIncrementMetaPropertyInfo(incrementName, 1, incrementColumn, keys.Any(x => x == incrementColumn));
     }
 }