1

会社が作成したアセンブリを選択する CQL クエリを作成しようとしています。

私の意見では、AssemblyInfo で生成されたデータを確認するのが最も簡単な方法ですが、CQL でデータにアクセスする方法が見つかりません。

4

1 に答える 1

0

コードクエリはどうですか:

from a in Application.Assemblies
where a.Name.StartsWith("YourCompany.YourProduct")
select a

それとももっと洗練されたものが必要ですか?


では、このデフォルト ルールからインスピレーションを得るのはどうですか:

// <Name>UI layer shouldn't use directly DB types</Name>
warnif count > 0

// UI layer is made of types in namespaces using a UI framework
let uiTypes = Application.Namespaces.UsingAny(Assemblies.WithNameIn("PresentationFramework", "System.Windows", "System.Windows.Forms", "System.Web")).ChildTypes()

// You can easily customize this line to define what are DB types.
let dbTypes = ThirdParty.Assemblies.WithNameIn("System.Data", "EntityFramework", "NHibernate").ChildTypes()
              // Ideally even DataSet and associated, usage should be forbidden from UI layer: 
              // http://stackoverflow.com/questions/1708690/is-list-better-than-dataset-for-ui-layer-in-asp-net
              .Except(ThirdParty.Types.WithNameIn("DataSet", "DataTable", "DataRow"))

from uiType in uiTypes.UsingAny(dbTypes)
let dbTypesUsed = dbTypes.Intersect(uiType.TypesUsed)
select new { uiType, dbTypesUsed }

もちろん、セットuiTypesdbTypesは、レベル N のアセンブリとレベル N+1 のアセンブリで調整する必要があります。

于 2013-09-26T09:52:10.280 に答える