Exemplo n.º 1
0
        /// <summary>
        /// Only intended to be used by the EntityFramework itself! Creates the native property information for a reflected managed property and returns the created managed EntityProperty. Returns 'null', if the property is not marked as 'EntityProperty', or no property converter can be found for the type of the property.
        /// </summary>
        /// <param name="managed">Managed.</param>
        internal static EntityProperty Create(PropertyInfo managed)
        {
            EntityPropertyAttribute attrib = (EntityPropertyAttribute)managed.GetCustomAttributes(typeof(EntityPropertyAttribute), true).FirstOrDefault();

            if (attrib == null)
            {
                return(null);
            }

            if (!s_converters.ContainsKey(managed.PropertyType))
            {
                return(null);
            }

            EEditTypes editType = attrib.EditType;

            if (editType == EEditTypes.Default)
            {
                editType = s_converters [managed.PropertyType].DefaultEditType;
            }
            string strEditType = StringValueAttribute.GetStringValue(editType);

            IEntityPropertyHandler.SPropertyInfo engine = new IEntityPropertyHandler.SPropertyInfo();
            engine.name        = managed.Name;
            engine.description = attrib.Description;
            engine.editType    = strEditType;
            engine.limits      = new IEntityPropertyHandler.SPropertyInfo.SLimits();
            engine.limits.min  = attrib.Min;
            engine.limits.max  = attrib.Max;
            engine.type        = s_converters [managed.PropertyType].EngineType;

            return(new EntityProperty(managed, engine, attrib.Default));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Only intended to be used by the EntityFramework itself!
 /// </summary>
 /// <param name="managed">Reflected property information.</param>
 /// <param name="engine">Native CRYENGINE property infromation.</param>
 /// <param name="defaultValue">Default value for the property.</param>
 private EntityProperty(PropertyInfo managed, IEntityPropertyHandler.SPropertyInfo engine, string defaultValue)
 {
     _managedInfo    = managed;
     _engineProperty = engine;
     _default        = defaultValue;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Only intended to be used by the EntityFramework itself!
 /// </summary>
 /// <param name="managed">Reflected property information.</param>
 /// <param name="engine">Native CRYENGINE property infromation.</param>
 /// <param name="defaultValue">Default value for the property.</param>
 private EntityProperty(PropertyInfo managed, IEntityPropertyHandler.SPropertyInfo engine)
 {
     _managedInfo    = managed;
     _engineProperty = engine;
 }