我有一个类,它定义了需要在两个单独的应用程序之间共享的事务。它们都引用了这个库,并且可以将类用作数据类型,但不能调用它的任何方法:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using ServerLibrary.MarketService;
namespace ServerLibrary
{
[ServiceContract]
public interface IService
{
[OperationContract]
string GetData(int value);
[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite);
[OperationContract]
bool ProcessTransaction(Transaction transaction);
}
[DataContract]
public class CompositeType
{
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
public bool BoolValue
{
get { return boolValue; }
set { boolValue = value; }
}
[DataMember]
public string StringValue
{
get { return stringValue; }
set { stringValue = value; }
}
}
// Transaction class to encapsulate products and checkout data
[DataContract]
public class Transaction
{
[DataMember]
public int checkoutID;
[DataMember]
public DateTime time;
[DataMember]
public List<Product> products;
[DataMember]
public double totalPrice;
[DataMember]
public bool complete;
public void Start(int ID)
{
checkoutID = ID;
products = new List<Product>();
complete = false;
}
public void Complete()
{
time = DateTime.Now;
complete = true;
}
}
}
我究竟做错了什么?
[更新] 我错过了其余的服务。
谢谢。