Click here to Skip to main content
15,896,359 members
Articles / Desktop Programming / WPF

The WPF-NHibernate Toolkit

Rate me:
Please Sign up or sign in to vote.
4.98/5 (23 votes)
16 Jan 2010CPOL28 min read 160.1K   3.3K   114  
Adapt NHibernate classes to run in WPF
using VmWrapperExpress.DomainModel;

namespace VmWrapperExpress.ViewModel
{
    public class PropertySpecVM : ViewModelBase
    {
        #region Constructor

        public PropertySpecVM(PropertySpecDM propertySpecsDM)
        {
            this.Initialize(propertySpecsDM);
        }

        #endregion

        #region InternalProperties

        /// <summary>
        /// The domain object wrapped by this view model object.
        /// </summary>
        public PropertySpecDM DomainObject { get; set; }

        #endregion

        #region Bindable Properties

        /// <summary>
        /// Whether this property is selected in the UI.
        /// </summary>
        public bool IsSelected
        {
            get { return DomainObject.IsSelected; }

            set
            {
                DomainObject.IsSelected = value;
                this.FirePropertyChangedEvent("IsSelected");
            }
        }

        /// <summary>
        /// The name of this property.
        /// </summary>
        public string Profile
        {
            get { return DomainObject.Profile; }
        }

        #endregion

        #region Overrides

        public override string ToString()
        {
            return this.Profile;
        }

        #endregion

        #region Private Methods

        /// <summary>
        /// Initializes this view model object.
        /// </summary>
        /// <param name="domainObject">The domain object to wrap.</param>
        private void Initialize(PropertySpecDM domainObject)
        {
            this.DomainObject = domainObject;
            this.IsSelected = domainObject.IsSelected;
        }

        #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
Software Developer (Senior) Foresight Systems
United States United States
David Veeneman is a financial planner and software developer. He is the author of "The Fortune in Your Future" (McGraw-Hill 1998). His company, Foresight Systems, develops planning and financial software.

Comments and Discussions