Helper methods for the IFieldInitializer/IObjectInitializer interfaces.
Beispiel #1
0
        void LoadInitializer(XmlElement element)
        {
            XmlElement initializerElement = element.SelectSingleNode("initializer") as XmlElement;

            if (null != initializerElement)
            {
                _initializer = (IObjectInitializer)InitializerHelper.LoadInitializer(initializerElement);
            }
        }
        public static object LoadInitializer(XmlElement element)
        {
            string typeName = element.GetAttribute("type");

            if (null == typeName || 0 == typeName.Length)
            {
                throw new ApplicationException(string.Format("Expected type attribute for element {0}!", element.LocalName));
            }

            Type type = Type.GetType(typeName);

            if (null == type)
            {
                throw new ApplicationException(string.Format("Type \"{0}\" not found!", typeName));
            }
            return(InitializerHelper.LoadInitializer(type, element));
        }
Beispiel #3
0
 /// <summary>
 /// Same as <see cref="InitializerHelper.SetField"/>(<see cref="CurrentObject"/>, name, value).
 /// </summary>
 /// <param name="name"></param>
 /// <param name="value"></param>
 public void SetCurrentObjectField(string name, object value)
 {
     InitializerHelper.SetField(CurrentObject, name, value);
 }
Beispiel #4
0
 public static IFieldInitializer LoadInitializer(Type type, XmlElement initializerElement)
 {
     return((IFieldInitializer)InitializerHelper.LoadInitializer(type, initializerElement));
 }