日期:2014-05-17 浏览次数:20797 次
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class BookService : IBookService
{
public void AddBook(Book book)
{
WcfServiceLibrary1.ServiceHelp.BookList.AddBook(book);
}
}
public class BookList
{
private static List<Book> _list = null;
public BookList()
{
_initializerList();
}
private void _initializerList()
{
if (_list == null)
{
_list = new List<Book>();
for (int i = 0; i < 10; i++)
{
_list.Add(new Book() { BookName = "C#" + i, BookNO = Guid.NewGuid(), BookPrice = 10 * i , NeedShow=true});
}
}
}
/// <summary>