如何(轻松)找到给定命名空间的正确程序集
我对某些属性有一些问题。我找不到合适的组件。我在谷歌上也找不到它们:
[Key, Column(Order = 0)]
[DatabaseGenerated(DatabaseGenerationOption.None)]
在 此代码声明了以下命名空间:
using System.Data.Entity.Database;
using System.Data.Entity.Infrastructure;
在哪里可以找到这些命名空间的程序集?除了在Google上搜索命名空间之外,是否有一种简单的方法可以找到程序集?
I have some problems with some attributes. I can't find the proper assembly. I can't find them on google either:
[Key, Column(Order = 0)]
[DatabaseGenerated(DatabaseGenerationOption.None)]
In this code the following namespaces are declared:
using System.Data.Entity.Database;
using System.Data.Entity.Infrastructure;
Where can I find the assemblies for these namespaces? Isn't there an easy way to find the assembly besides searching for the namespace on Google?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果您引用了程序集:
F12
。)当您没有引用程序集时:
当您要查找的课程不是来自 Microsoft 时:
您要查找的课程似乎不是来自 Microsoft。在这种情况下,您可以在对象浏览器中创建“自定义组件集”。您可以在其中添加要搜索的所有第三方程序集。最后,如果你没有程序集本身,我想剩下要做的就是谷歌。
In case you have the assembly referenced:
F12
in Visual Studio when cursor is on the definition you are searching for.)When you did not reference the assembly:
When the classes you are looking for aren't from microsoft:
It seems the classes you are looking for aren't from microsoft. In this case you can create a 'custom component set' in the Object Browser. You can add all third party assemblies there you want to search through. Lastly, if you don't have the assemblies themselves, I guess all there is left to do is Google.
从项目中删除所有
System.Data.*
引用,添加EntityFramework
引用,选项为DatabaseGenerateOption
(不是DatabaseGenerationOption
代码>)。Remove all
System.Data.*
references from the project, add theEntityFramework
reference, the option isDatabaseGeneratedOption
(notDatabaseGenerationOption
).问题在于
namespace
并不是 CLR 中的一等公民。命名空间+类名构成完整的类名。所以它只是一个通用的前缀。明显的结论是命名空间可以分布在不同的程序集中。您可以尝试逐个加载程序集,并检查每种类型的全名中是否有前缀 (StartsWith),该前缀将是您要查找的命名空间名称。The problem is that
namespace
is not first class citizen in CLR. namespace + class name constitutes the full class name. So it is just a common prefix. Obvious conclusion is that namespace can be distributed across different assemblies. You can try by loading assemblies one by one and examining each type's full name for prefix (StartsWith) that will be the namespace name you are trying to find.也许有点晚了,但我遇到了同样的问题,这就是我修复它的方法:
按照以下说明安装最新版本的实体框架:
http://nuget.org/packages/entityframework
出于某种原因,他们更改了属性,而不是 DatabaseGenerationOption
将其更改为DatabaseGenerateOption
并且它有效。
Maybe is a little bit late, but I got stuck with the same issue, this is what I did to fix it:
Install the latest version of the Entity Framework, following the instruction at:
http://nuget.org/packages/entityframework
For some reason they changed the name of the property, instead of DatabaseGenerationOption
change it for DatabaseGeneratedOption
And it works.
来自 MSDN 文档,大多数(如果不是全部)类来自这个命名空间的都在System.Data.Entity.Design.dll中,所以我相信它应该是这个。
所有 MSDN 文档页面都提到命名空间和程序集。
From MSDN docs, most if not all classes from this namespace are in System.Data.Entity.Design.dll, so I believe it should be this.
All MSDN doc pages mention namespace and assembly.
这是一个很好的问题,恐怕我不知道比 Google 更好的答案,或者 MSDN(如果是 Microsoft 的东西)。
给定的命名空间可以在多个程序集中声明,这一事实使问题变得更加复杂。相反,一个程序集可以声明多个命名空间。
请注意,这个问题几乎是一个我正在回答的问题部分的重复部分。
This is a good question, I'm afraid I don't know any better answer than Google, or MSDN if it's a Microsoft thing.
The problem is compounded by that fact that a given namespace can be declared in more than one assembly. And conversely, an assembly can declaremore than one namespace.
Note that this question is pretty much a duplicate of the part of your question that I'm answering.
这是添加此命名空间解析的解决方案:
Here is your solution add this namespace resolution: