Example #1
0
        ///<summary>Find models of type "type"</summary>
        public virtual Models                   FindType(Type type)
        {
            //Find a matching variable, of the specified type
            Models found = new Models(_engine);

            foreach (Model model in this)
            {
                if (model.GetType() == type || model.GetType().IsSubclassOf(type))
                {
                    found.Add(model);
                }
            }

            //Otherwise
            return(found);
        }
Example #2
0
        /// <summary>
        /// Constructor which takes multiple models.
        /// </summary>
        /// <param name="models">object of type Model</param>
        public ModelEngine(ModelEngine parent, params Model[] models)
            : base(null, null)
        {
            _parent = parent;
            _caller = parent;

            //Options
            if (parent != null)
            {
                _options = (ModelEngineOptions)parent.Options.Clone();    //Copy from parent
            }
            else
            {
                _options = (ModelEngineOptions)ModelEngineOptions.Default.Clone();          //Defaults
            }
            //Use passed in models, instead of finding them
            //Saves perf, and the user having to first clear, then add
            _models = new Models(this);
            _models.Add(models);
        }