域名

如何Master Data Service调用API创建Model

时间:2010-12-5 17:23:32  作者:数据库   来源:IT科技  查看:  评论:0
内容摘要:复制privatestaticServiceClientmdsProxy; protectedvoidPage_Load(objectsender,EventArgse)

如何Master Data Service调用API创建Model
复制private static ServiceClient mdsProxy;            protected void Page_Load(object sender,调用 EventArgs e)            {                try                {                    mdsProxy = CreateMdsProxy("http://devserver:8080/Service/Service.svc");                }                catch (Exception ex)                {                    Response.Redirect("Error connecting:" + ex.Message);                }            }            private static ServiceClient CreateMdsProxy(string mdsURL)            {                System.ServiceModel.EndpointAddress endptAddress = new System.ServiceModel.EndpointAddress(mdsURL);                System.ServiceModel.WSHttpBinding wsBinding = new System.ServiceModel.WSHttpBinding();                return new ServiceClient(wsBinding, endptAddress);            }            private void CreateModel(string newModelName)            {                MetadataCreateRequest request = new MetadataCreateRequest();                MetadataCreateResponse response = new MetadataCreateResponse();                request.Metadata = new Metadata();                request.Metadata.Models = new System.Collections.ObjectModel.Collection<Model>() { new Model() };                request.Metadata.Models[0].Identifier = new Identifier();                request.Metadata.Models[0].Identifier.Name = newModelName;                response = mdsProxy.MetadataCreate(request);            }            protected void btnCreateModel_Click(object sender, EventArgs e)            {                CreateModel("TestModel");            }        }    1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.
copyright © 2025 powered by 编程之道  滇ICP备2023006006号-34sitemap