public IList <MetaEntity> ExtractEntity(MetaEntityType type, string sql, object param = null)
        {
            string connStr = DbSettings.GetConnectionString(type.ToString());

            using (IDbConnection connection = new SqlConnection(connStr))
            {
                try
                {
                    connection.Open();

                    IList <MetaEntity> metaEntities = connection.Query(sql, param)
                                                      .Select(entity =>
                                                              new MetaEntity
                    {
                        Type       = type,
                        OriginalId = $"{entity.Id}",
                        Name       = entity.Name
                    }).ToList();

                    return(metaEntities);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex.Message);
                    throw new ApplicationException("抽取 Entity 失败", ex);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
 public IList <MetaEntity> ExtractEntity(MetaEntityType type, string sql, object param = null)
 {
     return(metaEntityRepository.ExtractEntity(type, sql, param));
 }
Esempio n. 3
0
 public string Rename(MetaEntityType entityType)
 {
     return entityType.Name;
 }