Click here to Skip to main content
15,886,199 members
Articles / Web Development / ASP.NET

Cascading Selection the MVC Way

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
29 Mar 2013CPOL12 min read 26K   509   25  
How to easily implement cascading selection the MVC way and leverage cached static data.
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by an Xomega.Net generator.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using AdventureWorks.Client.Objects;
using System;
using Xomega.Framework;
using Xomega.Framework.Properties;

namespace AdventureWorks.Client.Objects
{
    public partial class EmployeeRowObject : DataObject
    {
        #region Constants

        public const string Address = "Address";
        public const string Current = "Current";
        public const string FirstName = "FirstName";
        public const string Gender = "Gender";
        public const string HireDate = "HireDate";
        public const string Id = "Id";
        public const string LastName = "LastName";
        public const string Manager = "Manager";
        public const string Salaried = "Salaried";
        public const string StateId = "StateId";
        public const string Title = "Title";

        #endregion
        
        #region Properties

        public BooleanProperty CurrentProperty { get; private set; }
        public TextProperty FirstNameProperty { get; private set; }
        public EnumProperty GenderProperty { get; private set; }
        public DateProperty HireDateProperty { get; private set; }
        public IntegerProperty IdProperty { get; private set; }
        public TextProperty LastNameProperty { get; private set; }
        public TextProperty ManagerProperty { get; private set; }
        public BooleanProperty SalariedProperty { get; private set; }
        public StateProperty StateIdProperty { get; private set; }
        public TextProperty TitleProperty { get; private set; }

        #endregion

        #region Child Objects

        public AddressObject AddressObject { get { return (AddressObject)GetChildObject(Address); } }

        #endregion

        #region Construction

        protected override void Initialize()
        {
            CurrentProperty = new BooleanProperty(this, Current);
            CurrentProperty.Required = true;
            FirstNameProperty = new TextProperty(this, FirstName);
            FirstNameProperty.Size = 50;
            GenderProperty = new EnumProperty(this, Gender);
            GenderProperty.Required = true;
            GenderProperty.Size = 1;
            GenderProperty.EnumType = "gender";
            HireDateProperty = new DateProperty(this, HireDate);
            HireDateProperty.Required = true;
            IdProperty = new IntegerProperty(this, Id);
            LastNameProperty = new TextProperty(this, LastName);
            LastNameProperty.Size = 50;
            ManagerProperty = new TextProperty(this, Manager);
            ManagerProperty.Size = 50;
            SalariedProperty = new BooleanProperty(this, Salaried);
            StateIdProperty = new StateProperty(this, StateId);
            TitleProperty = new TextProperty(this, Title);
            TitleProperty.Required = true;
            TitleProperty.Size = 50;
            AddChildObject(Address, new AddressObject());
        }

        #endregion
    }

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Xomega.Net
United States United States
Xomega Team is striving to increase productivity and development quality by utilizing Model Driven Development coupled with Code Generation and the best design practices for application development.
We provide MDD tools, code generators and frameworks for Visual Studio and .Net development.
Visit us at http://www.xomega.net
This is a Organisation

1 members

Comments and Discussions