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

How to Build Flexible and Reusable WCF Services

Rate me:
Please Sign up or sign in to vote.
4.85/5 (13 votes)
6 May 2013GPL313 min read 77.2K   1.9K   126  
Design Patterns and best practices for building flexible and reusable WCF services.
//------------------------------------------------------------------------------
// <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 EmployeeObject : DataObject
    {
        #region Constants

        public const string BirthDate = "BirthDate";
        public const string Contact = "Contact";
        public const string CurrentFlag = "CurrentFlag";
        public const string EmployeeId = "EmployeeId";
        public const string Gender = "Gender";
        public const string HireDate = "HireDate";
        public const string Login = "Login";
        public const string Manager = "Manager";
        public const string MaritalStatus = "MaritalStatus";
        public const string ModifiedDate = "ModifiedDate";
        public const string NationalIDNumber = "NationalIDNumber";
        public const string PayHistory = "PayHistory";
        public const string Rowguid = "Rowguid";
        public const string SalariedFlag = "SalariedFlag";
        public const string SickLeaveHours = "SickLeaveHours";
        public const string TemporaryKey = "TemporaryKey";
        public const string Title = "Title";
        public const string VacationHours = "VacationHours";

        #endregion
        
        #region Properties

        public DateProperty BirthDateProperty { get; private set; }
        public BooleanProperty CurrentFlagProperty { get; private set; }
        public IntegerProperty EmployeeIdProperty { get; private set; }
        public EnumProperty GenderProperty { get; private set; }
        public DateProperty HireDateProperty { get; private set; }
        public TextProperty LoginProperty { get; private set; }
        public IntegerProperty ManagerProperty { get; private set; }
        public EnumProperty MaritalStatusProperty { get; private set; }
        public DateTimeProperty ModifiedDateProperty { get; private set; }
        public TextProperty NationalIDNumberProperty { get; private set; }
        public GuidProperty RowguidProperty { get; private set; }
        public BooleanProperty SalariedFlagProperty { get; private set; }
        public SmallIntegerProperty SickLeaveHoursProperty { get; private set; }
        public IntegerKeyProperty TemporaryKeyProperty { get; private set; }
        public TextProperty TitleProperty { get; private set; }
        public PositiveSmallIntProperty VacationHoursProperty { get; private set; }

        #endregion

        #region Child Objects

        public ContactObject ContactObject { get { return (ContactObject)GetChildObject(Contact); } }
        public DataObjectList<EmployeePayHistory> PayHistoryObjectList { get { return (DataObjectList<EmployeePayHistory>)GetChildObject(PayHistory); } }

        #endregion

        #region Construction

        protected override void Initialize()
        {
            BirthDateProperty = new DateProperty(this, BirthDate);
            BirthDateProperty.Required = true;
            CurrentFlagProperty = new BooleanProperty(this, CurrentFlag);
            CurrentFlagProperty.Required = true;
            EmployeeIdProperty = new IntegerProperty(this, EmployeeId);
            EmployeeIdProperty.Required = true;
            GenderProperty = new EnumProperty(this, Gender);
            GenderProperty.Required = true;
            GenderProperty.Size = 1;
            GenderProperty.EnumType = "gender";
            HireDateProperty = new DateProperty(this, HireDate);
            HireDateProperty.Required = true;
            LoginProperty = new TextProperty(this, Login);
            LoginProperty.Required = true;
            LoginProperty.Size = 256;
            ManagerProperty = new IntegerProperty(this, Manager);
            MaritalStatusProperty = new EnumProperty(this, MaritalStatus);
            MaritalStatusProperty.Required = true;
            MaritalStatusProperty.Size = 1;
            MaritalStatusProperty.EnumType = "marital status";
            ModifiedDateProperty = new DateTimeProperty(this, ModifiedDate);
            ModifiedDateProperty.Required = true;
            NationalIDNumberProperty = new TextProperty(this, NationalIDNumber);
            NationalIDNumberProperty.Required = true;
            NationalIDNumberProperty.Size = 15;
            RowguidProperty = new GuidProperty(this, Rowguid);
            RowguidProperty.Required = true;
            SalariedFlagProperty = new BooleanProperty(this, SalariedFlag);
            SalariedFlagProperty.Required = true;
            SickLeaveHoursProperty = new SmallIntegerProperty(this, SickLeaveHours);
            SickLeaveHoursProperty.Required = true;
            TemporaryKeyProperty = new IntegerKeyProperty(this, TemporaryKey);
            TitleProperty = new TextProperty(this, Title);
            TitleProperty.Required = true;
            TitleProperty.Size = 50;
            VacationHoursProperty = new PositiveSmallIntProperty(this, VacationHours);
            VacationHoursProperty.Required = true;
            AddChildObject(Contact, new ContactObject());
            AddChildObject(PayHistory, new DataObjectList<EmployeePayHistory>());
        }

        #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 GNU General Public License (GPLv3)


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