コード例 #1
0
        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();
                }
            }
        }
コード例 #2
0
 public IList <MetaEntity> ExtractEntity(MetaEntityType type, string sql, object param = null)
 {
     return(metaEntityRepository.ExtractEntity(type, sql, param));
 }
コード例 #3
0
ファイル: DefaultRenamer.cs プロジェクト: svallory/EdmxTypist
 public string Rename(MetaEntityType entityType)
 {
     return entityType.Name;
 }