我正在开发新的 WPF 和 MVVM 和 EF(代码优先)应用程序,以为其中一个构建销售点系统我的顾客。我看过网上和这里的指南。但是我仍然对数据库设计应该如何感到困惑?
我找到了一个我提到的this project设计的好例子。但是我有点担心可扩展性和质量。
我正在考虑建立这样的方案:
[Table("Customer")]
public partial class Customer
{
public int CustomerId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string FullName => FirstName + " " + LastName;
...
}
[Table("Category")]
public partial class Category
{
public int CategoryId { get; set; }
public string CategoryName { get; set; }
...
}
[Table("Brand")]
public partial class Brand
{
public int BrandId { get; set; }
public string BrandName { get; set; }
...
}
[Table("Product")]
public partial class Product
{
public int ProductId { get; set; }
public string ProductName { get; set; }
public int CategoryId { get; set; }
public int BrandId { get; set; }
public decimal ListPrice { get; set; }
...
}
[Table("Stock")]
public partial class Stock
{
public int ProductId { get; set; }
public int Quantity { get; set; }
...
}
[Table("Order")]
public partial class Order
{
public int OrderId { get; set; }
public int CustomerId { get; set; }
public int OrderStatus { get; set; }
public DateTime OrderDate { get; set; }
...
}
[Table("OrderItem")]
public partial class OrderItem
{
public int OrderId { get; set; }
public int ItemId { get; set; }
public int ProductId { get; set; }
public int Quantity { get; set; }
public decimal ListPrice { get; set; }
...
}
如果使用这样的方案,可能会出现什么问题?还是关于我应该照顾的计划有一点?
答案 0 :(得分:0)
对我来说,这看起来非常简单。我只有两条评论: