如何实现 IDataServiceMetadataProvider 并告诉我的数据服务使用该自定义提供程序?

发布于 2024-08-09 06:17:35 字数 604 浏览 4 评论 0原文

使用 IDataServiceMetadataProvider 实现 ADO.NET 数据服务的自定义提供程序,然后告诉数据服务使用该提供程序,没有明显的入口点。有人在这方面有运气吗?我尝试在我的数据源类上实现此接口,但没有命中任何断点。也没有(明显的)方法可以通过传递给 InitializeService 函数的数据服务的 DataServiceConfiguration 参数来设置提供程序。

任何帮助将不胜感激。谢谢!

数据服务提供程序(ADO.NET 数据服务)

IDataServiceMetadataProvider 会员

There's no obvious entry point for implementing a custom provider for an ADO.NET Data Service using IDataServiceMetadataProvider, and then telling a Data Service to use that provider. Has anyone had any luck in this area? I've tried implementing this interface on my Data Source class, but none of my breakpoints are hit. There is also no (obvious) way to set the provider from the Data Service's DataServiceConfiguration parameter passed in to the InitializeService function.

Any help would be appreciated. Thanks!

Data Services Providers (ADO.NET Data Services)

IDataServiceMetadataProvider Members

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

指尖凝香 2024-08-16 06:17:35

我们正在考虑修改 RTM 接口的一些文档。
同时,为了让数据服务运行时获取 IDataServiceMetadataProvider 实现,您需要在数据服务类上实现 IServiceProvider 接口。

MSDN 上的 IServiceProvider

示例:

public class northwindService:DataService<northwindContext> , IServiceProvider 
{
   public object GetService(Type serviceType) 
   {
      if (serviceType == typeof(IDataServiceMetadataProvider )) {
        //return instance of type which implements IDataServiceMetadataProvider 
       }
     return null;
    }  
}

We are looking at revising some of the documentation for these interfaces for RTM.
In the meantime , to get the Data Services runtime to pick up your IDataServiceMetadataProvider implementation , you will need to implement the IServiceProvider interface on your Data Service class .

IServiceProvider on MSDN

Sample :

public class northwindService:DataService<northwindContext> , IServiceProvider 
{
   public object GetService(Type serviceType) 
   {
      if (serviceType == typeof(IDataServiceMetadataProvider )) {
        //return instance of type which implements IDataServiceMetadataProvider 
       }
     return null;
    }  
}
巾帼英雄 2024-08-16 06:17:35

只是为了添加 Phani 回复,您需要确保从 GetService 调用返回 IDataServiceMetadataProvider 和 IDataServiceQueryProvider。对于其余接口,您可以选择从 GetService 返回它或在 DataSource 类上实现它。

希望这有帮助。

谢谢
普拉蒂克

Just to add to Phani reply, you need to make sure that you return both IDataServiceMetadataProvider and IDataServiceQueryProvider from the GetService call. For rest of the interfaces, you have a choice to return it from GetService or implement it on your DataSource class.

Hope this helps.

Thanks
Pratik

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文