Exemple #1
0
        /// <summary>
        /// Retrieves the model object type with the given name.
        /// </summary>
        /// <param name="typeName">Either a full (i.e. including the namespace) or partial model object type name</param>
        /// <returns>ModelObjectTypes object type with given name.</returns>
        public ModelObjectType GetModelObjectType(string typeName)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException("typeName");
            }
            ModelObjectType result = null;

            if (!modelObjectTypes.TryGetValue(typeName, out result))
            {
                foreach (KeyValuePair <string, ModelObjectType> item in modelObjectTypes)
                {
                    // If no matching type name was found, check if the given type projectName was a type projectName without namespace
                    if (string.Compare(item.Value.Name, typeName, StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        if (result == null)
                        {
                            result = item.Value;
                        }
                        else
                        {
                            throw new ArgumentException("The model object type '{0}' is ambiguous. Please specify the library name.", typeName);
                        }
                    }
                }
            }
            if (result == null)
            {
                throw new ArgumentException(string.Format("Model object type '{0}' was not registered.", typeName));
            }
            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Retrieves the model object type with the given name.
        /// </summary>
        /// <param name="typeName">Either a full (i.e. including the namespace) or partial model object type name</param>
        /// <returns>ModelObjectTypes object type with given name.</returns>
        public ModelObjectType GetModelObjectType(string typeName)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException("typeName");
            }
            ModelObjectType result = null;

            if (!_modelObjectTypes.TryGetValue(typeName, out result))
            {
                foreach (KeyValuePair <string, ModelObjectType> item in _modelObjectTypes)
                {
                    // If no matching type name was found, check if the given type projectName was a type projectName without namespace
                    if (string.Compare(item.Value.Name, typeName, StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        if (result == null)
                        {
                            result = item.Value;
                        }
                        else
                        {
                            throw new ArgumentException(Properties.Resources.MessageFmt_TheModelObjectType0IsAmbiguous, typeName);
                        }
                    }
                }
            }
            if (result == null)
            {
                throw new ArgumentException(string.Format(Properties.Resources.MessageFmt_ModelObjectType0WasNotRegistered, typeName));
            }
            return(result);
        }
Exemple #3
0
 /// <ToBeCompleted></ToBeCompleted>
 public static GenericModelObject CreateInstance(ModelObjectType modelObjectType)
 {
     if (modelObjectType == null)
     {
         throw new ArgumentNullException("modelObjectType");
     }
     return(new GenericModelObject(modelObjectType));
 }
Exemple #4
0
 /// <summary>
 /// Adds a model object type to the collection.
 /// </summary>
 /// <param name="modelObjectType"></param>
 public void Add(ModelObjectType modelObjectType)
 {
     if (modelObjectType == null)
     {
         throw new ArgumentNullException("modelObjectType");
     }
     modelObjectTypes.Add(modelObjectType.FullName, modelObjectType);
 }
Exemple #5
0
 /// <summary>
 /// Removes a model object type from the collection.
 /// </summary>
 /// <param name="modelObjectType"></param>
 public bool Remove(ModelObjectType modelObjectType)
 {
     if (modelObjectType == null)
     {
         throw new ArgumentNullException("modelObjectType");
     }
     return(modelObjectTypes.Remove(modelObjectType.FullName));
 }
Exemple #6
0
 /// <ToBeCompleted></ToBeCompleted>
 protected internal ModelObjectBase(ModelObjectType modelObjectType)
 {
     if (modelObjectType == null)
     {
         throw new ArgumentNullException("ModelObjectType");
     }
     this.modelObjectType = modelObjectType;
     this.name            = modelObjectType.GetDefaultName();
 }
Exemple #7
0
 internal bool IsModelObjectTypeRegistered(ModelObjectType modelObjectType)
 {
     return(modelObjectTypes.ContainsKey(modelObjectType.FullName));
 }
Exemple #8
0
 /// <ToBeCompleted></ToBeCompleted>
 protected internal GenericModelObject(ModelObjectType modelObjectType)
     : base(modelObjectType)
 {
 }