GetObjectProviderName() public static method

Returns the name of an object provider base on the type name specified in it's configuration file.
public static GetObjectProviderName ( ObjectDefinition objDef ) : string
objDef ObjectDefinition The ObjectDefinition to get the type name from
return string
        private System.Collections.ObjectModel.Collection <ObjectProvider> GetObjectProviders()
        {
            this.providers = new System.Collections.ObjectModel.Collection <ObjectProvider>();
            ObjectDefinition objDef = null;

            // This will need to be modified to reflect utilizing a different directory
            foreach (string configFileName in Directory.GetFiles(this.GetConfigPath <DynamicCrmAdapterDestination>()))
            {
                using (var fs = File.OpenRead(configFileName))
                {
                    using (var xr = XmlReader.Create(fs))
                    {
                        var serializer = new XmlSerializer(typeof(ObjectDefinition));
                        objDef = (ObjectDefinition)serializer.Deserialize(xr);
                    }
                }

                if (!IsStaticObjectProvider(objDef))
                {
                    DynamicObjectProvider dynObject = new DynamicObjectProvider()
                    {
                        Adapter = this, Id = GetDynamicProviderId(objDef), DisplayName = objDef.RootDefinition.DisplayName, Name = CRM2011AdapterUtilities.GetObjectProviderName(objDef)
                    };
                    this.providers.Add(dynObject);
                }

                if (objDef.RootDefinition.Name.Equals("OptionList"))
                {
                    PicklistObjectProvider pickObject = new PicklistObjectProvider()
                    {
                        Adapter = this
                    };
                    this.providers.Add(pickObject);
                }
            }

            return(this.providers);
        }
Esempio n. 2
0
        private System.Collections.ObjectModel.Collection <ObjectProvider> GetObjectProviders()
        {
            this.providers = new System.Collections.ObjectModel.Collection <ObjectProvider>();
            ObjectDefinition objDef = null;

            foreach (string configFileName in Directory.GetFiles(this.GetConfigPath <DynamicCrmAdapter>()))
            {
                using (var fs = File.OpenRead(configFileName))
                {
                    using (var xr = XmlReader.Create(fs))
                    {
                        var serializer = new XmlSerializer(typeof(ObjectDefinition));
                        objDef = (ObjectDefinition)serializer.Deserialize(xr);
                    }
                }

                if (!IsStaticObjectProvider(objDef))
                {
                    DynamicObjectProvider dynObject = new DynamicObjectProvider()
                    {
                        Adapter = this, Id = GetDynamicProviderId(objDef), DisplayName = objDef.RootDefinition.DisplayName, Name = CRM2011AdapterUtilities.GetObjectProviderName(objDef)
                    };
                    this.providers.Add(dynObject);
                }
            }

            return(this.providers);
        }