Tag: 元数据

MEF2中强类型元数据(System.Composition)

我在新的ASP.NET MVC4项目中使用来自MEF的System.Composition命名空间用于Web和Windowsapp store应用NuGet包 。 我已经读过 ,在MEF2中你不再使用Lazy ,但是现在你必须为元数据视图提供一个具体的类型(并且可能使用ExportFactory 而不是Lazy ?)。 但是,我找不到任何关于如何工作的例子 – 只提到使用具体类型而不是接口。 我已经尝试了一些方法,但不断收到以下错误 – “ 缺少’AccountID’的导出元数据,并且没有提供默认值 ”。 我的代码…… 创建容器(在Global.asax或App_Start文件夹中): // Get assemblies that will be providing imports and exports var assemblies = GetAssemblies(); // Get conventions that will be used to find imports and exports var conventions = GetConventions(); var container = new ContainerConfiguration().WithAssemblies(assemblies, conventions).CreateContainer(); […]

WCF Test Client无法添加服务,无法获取元数据

我可以告诉我为什么当我尝试添加服务时出现此错误? 错误:无法从http:// myserver / myapp获取元数据。 如果这是您有权访问的Windows(R)Communication Foundation服务,请检查您是否已在指定地址启用元数据发布。 有关启用元数据发布的帮助,请参阅http://go.microsoft.com/fwlink/?LinkId=65455上的MSDN文档。 WS-Metadata Exchange错误URI: http:// myserver / myapp元数据包含无法解析的引用:’ http:// myserver / myapp ‘。 远程服务器返回意外响应:(405)方法不允许。 远程服务器返回错误:(405)方法不允许.HTTP GET错误URI: http:// myserver / myapp下载’ http:// myserver / myapp ‘时出错。 请求失败,HTTP状态为403:Forbidden。 更新:我已经有以下端点了, 我也设置了服务行为:

将新的元数据属性添加到文件中

我想为一些文件添加一些元数据属性。 就像doc文件的所有者,计算机,标题,主题等一样,我希望能够添加一些自定义属性。 怎么办?

WCF元数据缺少操作

我有一个在Visual Studio中运行的简单Web服务。 如果我尝试查看元数据,则缺少有关操作的信息,因此svcutil会生成客户端代码,而无需任何方法。 我的设置有什么问题吗? 接口: [System.ServiceModel.ServiceContractAttribute(Namespace=”http://Test/Publish”, ConfigurationName=”IFCRPublish”)] public interface IFCRPublish { // CODEGEN: Generating message contract since the operation PublishNotification is neither RPC nor document wrapped. [System.ServiceModel.OperationContractAttribute(Action=”http://Test/PublishNotification”, ReplyAction=”*”)] PublishNotificationResponse1 PublishNotification(PublishNotificationRequest1 request); } 响应: [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute(“System.ServiceModel”, “3.0.0.0”)] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class PublishNotificationResponse1 { [System.ServiceModel.MessageBodyMemberAttribute(Namespace=”http://Test/PublishTypes”, Order=0)] public PublishNotificationResponse PublishNotificationResponse; public PublishNotificationResponse1() { } public PublishNotificationResponse1(PublishNotificationResponse PublishNotificationResponse) { […]

Attribute.IsDefined没有看到使用MetadataType类应用的属性

如果我通过MetadataType属性将属性应用于部分类,则不会通过Attribute.IsDefined()找到这些属性。 任何人都知道为什么,或者我做错了什么? 下面是我为此创建的测试项目,但我真的尝试将自定义属性应用于LINQ to SQL实体类 – 就像这个问题中的答案一样。 谢谢! using System; using System.ComponentModel.DataAnnotations; using System.Reflection; namespace MetaDataTest { class Program { static void Main(string[] args) { PropertyInfo[] properties = typeof(MyTestClass).GetProperties(); foreach (PropertyInfo propertyInfo in properties) { Console.WriteLine(Attribute.IsDefined(propertyInfo, typeof(MyAttribute))); Console.WriteLine(propertyInfo.IsDefined(typeof(MyAttribute), true)); Console.WriteLine(propertyInfo.GetCustomAttributes(true).Length); // Displays: // False // False // 0 } Console.ReadLine(); } } [MetadataType(typeof(MyMeta))] public partial […]

检索MS Access文件中的表列表

如果我可以在C#中打开与MS Access文件的连接,如何检索Access DB中存在的不同表的列表(如果可能,还可以检索与表关联的任何元数据)?