예제 #1
0
        static public string AutoGenKey(ref EntityRow row)
        {
            var table = row.Table;

            if (table == null)
            {
                return(null);
            }

            var pk     = row.Table.PrimaryKey;
            var keyGen = pk.GetAttributesEntity().KeyGen;

            if (string.IsNullOrEmpty(keyGen))
            {
                return(null);
            }
            var  tableAttri = table.GetAttributesEntity();
            long keyIndex   = tableAttri.KeyCount + 1;
            var  key        = CommonExtension.StringFormat(keyGen, keyIndex);

            tableAttri.KeyCount = keyIndex;
            row.SetValue(table.PrimaryKey, key, true);
            return(key);
            //Table.GetAttributesEntity().KeyCount
        }