自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何Master Data Service調(diào)用API創(chuàng)建Model

數(shù)據(jù)庫 SQL Server
這里我們首先需要啟用MDS當中的Web Service服務,啟動方法見《 如何啟用Master Data Services的Web服務

概述

這里我們首先需要啟用MDS當中的Web Service服務,啟動方法見《 如何啟用Master Data Services的Web服務》。

添加服務引用

  • 在解決方案資源管理器窗口中,右鍵單擊引用,單擊添加服務引用;
  • 在地址,輸入的 URL 的 MDS 服務將"http:// / / service/service.svc"。如果 MDS 位于的計算機上執(zhí)行此操作,可以使用"localhost"作為服務器名稱;
  • 單擊繼續(xù)。Visual Studio 會嘗試獲取服務并檢索 WSDL;
  • 如果成功,將看到服務和IService在服務框中;
  • 該服務的Namespace框中指定命名空間。在此示例中,我將其命名為MDService;
  • 單擊高級按鈕,可以配置高級的設置;
  • 勾選Always generate message contracts(不確定中文版翻譯成什么);
  • 設置集合類型下拉到System.Collections.ObjectModel.Collection;
  • 單擊確定返回到添加服務引用對話框;

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

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

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

原文鏈接:http://blog.csdn.net/xuyue1987/article/details/6642449

 

 

責任編輯:艾婧 來源: 徐悅 Tech Blog
相關(guān)推薦

2009-04-13 11:31:55

IBMdWWebService

2011-07-28 13:51:31

Master DataWeb服務

2011-07-29 10:02:06

SQL Server 主數(shù)據(jù)服務

2009-08-11 14:16:00

Winform調(diào)用WEC#

2009-12-09 09:58:07

ibmdwService

2012-12-25 10:44:06

IBMdW

2023-11-30 09:18:27

2020-12-02 08:28:58

JavaScript API 服務器

2009-12-25 17:28:01

ADO Data 控件

2009-08-14 15:02:24

Service模板C#創(chuàng)建

2021-10-09 23:33:55

監(jiān)控

2009-12-22 17:09:34

ADO.NET Ent

2009-12-30 10:49:32

ADO.NET Ent

2009-12-30 15:50:18

ADO.NET Dat

2022-03-15 12:43:44

Web APIAPI

2022-03-29 09:00:00

Angular框架REST API

2020-11-18 19:11:26

iOSFlutterNative

2021-04-26 05:33:54

Python異步編程

2011-04-28 15:18:59

2009-08-11 13:27:22

C#創(chuàng)建Web Ser
點贊
收藏

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