偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

使用SQL Server 2008 R2的主數(shù)據(jù)服務(wù)調(diào)用API創(chuàng)建Model

數(shù)據(jù)庫 SQL Server
本文我們主要介紹了使用SQL Server 2008 R2的主數(shù)據(jù)服務(wù)MDS調(diào)用API創(chuàng)建Model的過程,希望能夠?qū)δ兴鶐椭?/div>

SQL Server 2008 R2主數(shù)據(jù)服務(wù)(Master Data Services,簡稱MDS)可以調(diào)用應(yīng)用程序接口API來創(chuàng)建Model,本文我們就介紹了這一創(chuàng)建的過程,需要說明的是首先需要啟用MDS當(dāng)中的Web Service服務(wù),啟動方法可以參考這篇文章:如何啟用Master Data Services的Web服務(wù)。接下來我們就開始介紹這一過程。

添加服務(wù)引用

在解決方案資源管理器窗口中,右鍵單擊引用,單擊添加服務(wù)引用;在地址,輸入的 URL 的 MDS 服務(wù)將"http:// <ServerName> / <MdsSiteName> / service/service.svc"。如果MDS 位于的計算機上執(zhí)行此操作,可以使用"localhost"作為服務(wù)器名稱;單擊繼續(xù)。Visual Studio 會嘗試獲取服務(wù)并檢索 WSDL;如果成功,將看到服務(wù)和IService在服務(wù)框中;該服務(wù)的Namespace框中指定命名空間。

在此示例中,我將其命名為MDService;單擊高級按鈕,可以配置高級的設(shè)置;勾選Always generate message contracts(不確定中文版翻譯成什么);設(shè)置集合類型下拉到System.Collections.ObjectModel.Collection;單擊確定返回到添加服務(wù)引用對話框。

通過API創(chuàng)建模型

  1. private static ServiceClient mdsProxy;    
  2.  
  3. protected void Page_Load(object sender, EventArgs e)    
  4.  
  5. {    
  6.  
  7. try    
  8.  
  9. {    
  10.  
  11. mdsProxy = CreateMdsProxy("http://devserver:8080/Service/Service.svc");    
  12.  
  13. }    
  14.  
  15. catch (Exception ex)    
  16.  
  17. {    
  18.  
  19. Response.Redirect("Error connecting:" + ex.Message);    
  20.  
  21. }    
  22.  
  23. }    
  24.  
  25. private static ServiceClient CreateMdsProxy(string mdsURL)    
  26.  
  27. {    
  28.  
  29. System.ServiceModel.EndpointAddress endptAddress = new System.ServiceModel.EndpointAddress(mdsURL);    
  30.  
  31. System.ServiceModel.WSHttpBinding wsBinding = new System.ServiceModel.WSHttpBinding();    
  32.  
  33. return new ServiceClient(wsBinding, endptAddress);    
  34.  
  35. }    
  36.  
  37. private void CreateModel(string newModelName)    
  38.  
  39. {    
  40.  
  41. MetadataCreateRequest request = new MetadataCreateRequest();    
  42.  
  43. MetadataCreateResponse response = new MetadataCreateResponse();    
  44.  
  45. request.Metadata = new Metadata();    
  46.  
  47. request.Metadata.Models = new System.Collections.ObjectModel.Collection<Model>() { new Model() };    
  48.  
  49. request.Metadata.Models[0].Identifier = new Identifier();    
  50.  
  51. request.Metadata.Models[0].Identifier.Name = newModelName;    
  52.  
  53. response = mdsProxy.MetadataCreate(request);    
  54.  
  55. }    
  56.  
  57. protected void btnCreateModel_Click(object sender, EventArgs e)    
  58.  
  59. {    
  60.  
  61. CreateModel("TestModel");    
  62.  
  63. }    
  64.  
  65. }  

注意:MDS的站點有緩存機制,如果你之前已經(jīng)打開了該站點,則刷新之后不會看到新添加的那個Model,需要關(guān)閉瀏覽器或清理緩存。

使用SQL Server 2008 R2的主數(shù)據(jù)服務(wù)調(diào)用API創(chuàng)建Model

 關(guān)于使用SQL Server 2008 R2的主數(shù)據(jù)服務(wù)MDS調(diào)用API創(chuàng)建Model的過程就介紹到這里了,希望本次的介紹能夠帶給您一些收獲吧!

【編輯推薦】

  1. 如何啟用Master Data Services的Web服務(wù)
  2. MySQL數(shù)據(jù)庫如何實現(xiàn)跨表更新與數(shù)據(jù)并合
  3. MySQL數(shù)據(jù)庫修改MySQL密碼的六種措施總結(jié)
  4. SQL Server數(shù)據(jù)庫如何使用存儲過程造批量數(shù)據(jù)
  5. 如何將SQL Server 2008的數(shù)據(jù)復(fù)制到MySQL數(shù)據(jù)庫
責(zé)任編輯:趙鵬 來源: CSDN博客
相關(guān)推薦

2010-02-26 16:36:46

SQL Server

2011-08-17 18:00:15

SQL Server MDS

2010-11-26 14:08:00

SQL Server

2010-11-26 14:11:33

SQL Server

2012-09-06 16:48:05

Windows Ser

2010-12-07 16:40:17

Windows Ser

2009-11-12 10:12:21

主數(shù)據(jù)管理SQL Server

2010-12-27 09:48:36

2010-04-20 09:13:35

SQL Server

2010-12-20 15:59:59

SQL Server

2010-11-01 13:47:56

Windows Ser

2012-07-10 09:50:55

SQL Server

2011-01-26 13:26:05

Windows Sto

2010-04-30 15:23:03

Server 2008托管賬號

2010-05-04 11:25:19

Windows Ser

2011-08-24 16:25:08

SQL Server 故障轉(zhuǎn)移群集

2010-11-30 15:40:20

Windows Ser

2010-05-07 09:13:26

SQL Server

2009-08-12 09:19:26

SQL Server

2010-04-22 09:17:03

SQL Server
點贊
收藏

51CTO技術(shù)棧公眾號