|  |  | 
 |  |  |                 CodeRuleAttribute? codeRuleAttribute = propertyInfo.GetCustomAttribute<CodeRuleAttribute>(); | 
 |  |  |                 if (codeRuleAttribute != null) | 
 |  |  |                 { | 
 |  |  |                     SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig | 
 |  |  |                     if (propertyInfo.GetValue(entityInfo.EntityValue) == null) | 
 |  |  |                     { | 
 |  |  |                         ConfigId = MainDb.CurrentDbConnId, | 
 |  |  |                         ConnectionString = DBContext.GetMainConnectionDb().Connection, | 
 |  |  |                         IsAutoCloseConnection = true, | 
 |  |  |                         DbType = MainDb.DbType, | 
 |  |  |                     }); | 
 |  |  |                     dynamic ruleConfig = sugarClient.Queryable(MainDb.CodeRuleConfig, "x").Where(nameof(CodeRuleAttribute.RuleCode), "=", codeRuleAttribute.RuleCode.ToString()).First(); | 
 |  |  |                     if (ruleConfig != null) | 
 |  |  |                     { | 
 |  |  |                         string code = CreateCodeByRule(ruleConfig, sugarClient); | 
 |  |  |                         propertyInfo.SetValue(entityInfo.EntityValue, code, null); | 
 |  |  |                         SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig | 
 |  |  |                         { | 
 |  |  |                             ConfigId = MainDb.CurrentDbConnId, | 
 |  |  |                             ConnectionString = DBContext.GetMainConnectionDb().Connection, | 
 |  |  |                             IsAutoCloseConnection = true, | 
 |  |  |                             DbType = MainDb.DbType, | 
 |  |  |                         }); | 
 |  |  |                         dynamic ruleConfig = sugarClient.Queryable(MainDb.CodeRuleConfig, "x").Where(nameof(CodeRuleAttribute.RuleCode), "=", codeRuleAttribute.RuleCode.ToString()).First(); | 
 |  |  |                         if (ruleConfig != null) | 
 |  |  |                         { | 
 |  |  |                             string code = CreateCodeByRule(ruleConfig, sugarClient); | 
 |  |  |                             propertyInfo.SetValue(entityInfo.EntityValue, code, null); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  |