コード例 #1
0
 public static ConfigObjectCollection FindAll(Type objectType)
 {
     if (null == objectType)
     {
         throw new ArgumentNullException("objectType");
     }
     DataSourceManager[] dataSourceManagers = DataSourceManager.GetDataSourceManagers(objectType, "Identity");
     ConfigObject[]      array = dataSourceManagers[0].Find(objectType, string.Empty, true, null);
     ConfigObjectReader.FillObjects(dataSourceManagers, array, objectType);
     return(new ConfigObjectCollection(array));
 }
コード例 #2
0
        public static ConfigObject FindById(Type objectType, string objectIdentity)
        {
            if (null == objectType)
            {
                throw new ArgumentNullException("objectType");
            }
            if (string.IsNullOrEmpty(objectIdentity))
            {
                throw new ArgumentException("Argument 'objectIdentity' was null or emtpy.");
            }
            DataSourceManager[] dataSourceManagers = DataSourceManager.GetDataSourceManagers(objectType, "Identity");
            ConfigObject        configObject       = dataSourceManagers[0].Read(objectType, objectIdentity);

            if (configObject != null)
            {
                ConfigObject[] configObjects = new ConfigObject[]
                {
                    configObject
                };
                ConfigObjectReader.FillObjects(dataSourceManagers, configObjects, objectType);
            }
            return(configObject);
        }