Back to list
Views:   3.1K
Replies:  0

MVP pattern on .net 4.5 problem with the presenter class


I'm using the MVP for winform project in .net 4.5 C# 5.0.

The problem is in my presenter class witch create new instance at each time on .net 4.5

protected static IModel Model; with a static constructor (static Presenter()) and a public constructor public Presenter(T view)
Event if my member Model is static it create a new instance.

Any ideal what is the problem in C# 5.0

public class Presenter<T> where T : IView
        /// <summary>        /// Gets and sets the model statically.        /// </summary>        protected static IModel Model;

        /// <summary>        /// Gets the view.        /// </summary>        /// <value>        /// The view.        /// </value>        protected T View { get; private set; }

        /// <summary>        /// Initializes a new instance of the <see cref="Presenter{T}" /> class.        /// </summary>        static Presenter()
            Model = new Model();

        /// <summary>        /// Initializes a new instance of the <see cref="Presenter{T}" /> class.        /// </summary>        /// <param name="view">The view.</param>        public Presenter(T view)
            View = view;

Martin La Salle, Nov 09, 2012

Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas.      Vsn 1.3.0