Пример #1
0
        public MVCModel()
        {
            //init SomeComponent property backed by setting component
            if (SettingsController <MVCSettings> .Settings == null)
            {
                //ensures that there is a new instance of Settings backing persisted properties in model
                SettingsController <MVCSettings> .New();
            }
            Debug.Assert(SettingsController <MVCSettings> .Settings != null, "SettingsController<MVCSettings>.Settings != null");

            //init some other component property NOT backed by settings, but backed by model component
            StillAnotherComponent = new MVCModelComponent();
        }
Пример #2
0
        /// <summary>
        /// Compare property values of two specified Settings objects.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public override Boolean Equals(IModelComponent other)
        {
            Boolean           returnValue = default(Boolean);
            MVCModelComponent otherModel  = default(MVCModelComponent);

            try
            {
                otherModel = other as MVCModelComponent;

                if (this == otherModel)
                {
                    returnValue = true;
                }
                else
                {
                    if (!base.Equals(other))
                    {
                        returnValue = false;
                    }
                    else if (this.StillAnotherInt != otherModel.StillAnotherInt)
                    {
                        returnValue = false;
                    }
                    else if (this.StillAnotherBoolean != otherModel.StillAnotherBoolean)
                    {
                        returnValue = false;
                    }
                    else if (this.StillAnotherString != otherModel.StillAnotherString)
                    {
                        returnValue = false;
                    }
                    else
                    {
                        returnValue = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);
                throw;
            }

            return(returnValue);
        }