0

在我的项目中,我创建了一个对象并放置了一些值,但是当保存这些值时,我的演示者没有得到相同的值

我将这些值输入到我的组件文件中

SaveOrder abcd = somecomponent.create();

在 somecomponent.cs 文件中,我编写了此方法create(),例如

public SaveOrder create()
{
    abcd.xyz = new Data.Hibernate.Model.dddd.xyz();

    abcd.xyz .Customer = blahblah;
    abcd.xyz .Device = blahblah;
} 

在 SaveOrder.cs 文件中,我像这样声明了 xyz

  public virtual xyz xyz{ get; set; }

而我的 xyz.cs 是这样的

namespace Myproject.Data.Hibernate.Model.xyz
{
    [Serializable] public class xyz: IEntity, IEquatable<xyz>
    {      
        public virtual int Id { get; set; }
        public virtual string Other { get; set; }
        public virtual int? Device { get; set; }

    public override int GetHashCode()
    {
        unchecked
        {
            int hashCode = Id;
            hashCode = (hashCode * 397) ^ (Other != null ? Other.GetHashCode() : 0);
            hashCode = (hashCode * 397) ^ Device.GetHashCode();
            return hashCode;
        }
    }

    public virtual bool Equals(xyz other)
    {
        if (ReferenceEquals(null, other)) return false;
        if (ReferenceEquals(this, other)) return true;
        return Id == other.Id 
            && string.Equals(Other, other.Other) 
            && Device == other.Device;
    }

    public override bool Equals(object obj)
    {
        if (ReferenceEquals(null, obj)) return false;
        if (ReferenceEquals(this, obj)) return true;
        if (obj.GetType() != GetType()) return false;
        return Equals((xyz)obj);
    }      
}

我的 Presenter 文件是这样的

namespace Myproject.Business.Presenters.xyz
{
    public abstract class BasexyzTabPresenter<TOrderComponent, TOrder> 
        : BaseTabPresenter<IPageView>
        where TOrderComponent : BaseComponent<TOrder>
        where TOrder : BaseOrder
    {
        private readonly XYZPanel _xyzPanel;

        private readonly TOrder _order;
        private readonly TOrderComponent _orderComponent;
        protected BasexyzTabPresenter
            (TOrderComponent orderComponent, XYZPanel xyzPanel, TOrder order, IPageView view)
            : base(view)
        {
            _xyzPanel = xyzPanel;
            _order = order;
            _orderComponent = orderComponent;
        }

在演示者中,我无法在TOrder order.

编辑

在 SaveOrder.cs public virtual xyz xyz{ get; 放; 当控制权交给 Presenter 时,无法访问模型。这是这里的主要问题。请帮忙

4

0 回答 0