add_PropertyChanged应该是'public / protected virtual'或'protected error

时间:2015-09-04 08:39:47

标签: wcf model-view-controller nhibernate fluent-nhibernate

我正在使用MVC - WCF Service和Fluent NHibernate,但我遇到了错误 关于连接。

方法add_PropertyChanged应为'public / protected virtual'或'protected internal virtual

public class ReportService : IReportService
{
protected static List<Customer> Customers;
public List<Customer> GetReport(string Name,string Surname,string Address,string Phone) {
    //NHibernate üzerinden select
    Customers = new List<Customer>();

    using (var session = NHibernateHelper.OpenSession())
    {
        using (var transaction = session.BeginTransaction())
        {
            var results = from c in session.Query<Customer>()
                          select c;
            foreach (var result in results)
            {
                Customer customer = new Customer
                {
                    CustomerId = result.CustomerId,
                    Name = result.Name,
                    Surname = result.Surname,
                    Address = result.Address,
                    Phone = result.Phone
                };
                Customers.Add(customer);
            }

            if (Customers.Count>0)
            {
                return Customers;
            }
            else
            {
                return null;
            }
        }
    }
}

实体:

public class Customer
{
    public  virtual int CustomerId { get; set; }
    public virtual string Name { get; set; }
    public virtual string Surname { get; set; }

    public virtual string Phone { get; set; }

    public virtual string Address { get; set; }
}

0 个答案:

没有答案