private void CreateHostDesignerModel(ServiceContract sc)
        {
            hdStore       = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel));
            hdDomainModel = hdStore.GetDomainModel <HostDesignerDomainModel>();
            hdTransaction = hdStore.TransactionManager.BeginTransaction();
            hdModel       = (HostDesignerModel)hdDomainModel.CreateElement(new Partition(hdStore), typeof(HostDesignerModel), null);

            HostApplication app = (HostApplication)hdStore.ElementFactory.CreateElement(HostApplication.DomainClassId);

            app.ImplementationTechnology = new HostDesignerWcfExtensionProvider();

            reference = (ServiceReference)hdStore.ElementFactory.CreateElement(ServiceReference.DomainClassId);

            //mel://[DSLNAMESPACE]\[MODELELEMENTTYPE]\[MODELELEMENT.GUID]@[PROJECT]\[MODELFILE]
            string serviceMoniker = string.Format(@"mel://{0}\{1}\{2}@{3}\{4}",
                                                  sc.GetType().Namespace,
                                                  serviceContractName,
                                                  sc.Id.ToString(),
                                                  serviceContractModelProjectName, serviceContractModelFileName);

            reference.Name = serviceMelReferenceName;
            reference.ServiceImplementationType = new MockModelBusReference(sc);

            app.ServiceDescriptions.Add(reference);
        }
示例#2
0
        public void TestInitialize()
        {
            serviceProvider = new MockMappingServiceProvider();

            scStore       = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel));
            scDomainModel = scStore.GetDomainModel <ServiceContractDslDomainModel>();
            scTransaction = scStore.TransactionManager.BeginTransaction();

            scModel = (ServiceContractModel)scDomainModel.CreateElement(new Partition(scStore), typeof(ServiceContractModel), null);
            scModel.ImplementationTechnology = new ServiceContractWCFExtensionProvider();
            scModel.ProjectMappingTable      = projectMappingTableName;

            ServiceContract sc = scStore.ElementFactory.CreateElement(ServiceContract.DomainClassId) as ServiceContract;

            sc.Name = serviceContractName;

            scModel.ServiceContracts.Add(sc);

            hdStore       = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel));
            hdDomainModel = hdStore.GetDomainModel <HostDesignerDomainModel>();
            hdTransaction = hdStore.TransactionManager.BeginTransaction();
            hdModel       = (HostDesignerModel)hdDomainModel.CreateElement(new Partition(hdStore), typeof(HostDesignerModel), null);

            HostApplication app = (HostApplication)hdStore.ElementFactory.CreateElement(HostApplication.DomainClassId);

            app.ImplementationTechnology = new HostDesignerWcfExtensionProvider();

            reference = (ServiceReference)hdStore.ElementFactory.CreateElement(ServiceReference.DomainClassId);

            //mel://[DSLNAMESPACE]\[MODELELEMENTTYPE]\[MODELELEMENT.GUID]@[PROJECT]\[MODELFILE]
            string serviceMoniker = string.Format(@"mel://{0}\{1}\{2}@{3}\{4}",
                                                  sc.GetType().Namespace,
                                                  serviceContractName,
                                                  sc.Id.ToString(),
                                                  serviceContractModelProjectName, serviceContractModelFileName);

            reference.Name = serviceMelReferenceName;
            reference.ServiceImplementationType = new MockModelBusReference(sc);

            app.ServiceDescriptions.Add(reference);

            // Initialize validator's config
            attributes = new NameValueCollection();
            attributes.Add("elementNameProperty", "Name");
        }