Add() public method

Adds the specified model.
public Add ( ActiveRecordModel model ) : void
model ActiveRecordModel The model.
return void
Ejemplo n.º 1
0
        /// <summary>
        /// Creates a <see cref="ActiveRecordModel"/> from the specified type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public ActiveRecordModel Create(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (type.IsDefined(typeof(ActiveRecordSkipAttribute), false))
            {
                return(null);
            }

            ActiveRecordModel model = new ActiveRecordModel(type);

            coll.Add(model);

            PopulateModel(model, type);

            ActiveRecordBase.Register(type, model);

            return(model);
        }