asp.net - 农场相关项目的数据模型结构
问题描述
我目前正在尝试找出一个数据模型,并在它变得相当复杂时苦苦挣扎。我到目前为止所得到的解释如下。我将在 ASP.NET CORE MVC 应用程序中实现这一点,以帮助远程管理收获。
数据模型如下: 农场可以有多个田地,每个田地可以种植多种作物。每个农场还可以有多个不同作物的收成,我需要能够存储有关该收成的总作物产量的信息,该收成特定于该农场。任何帮助将不胜感激!
谢谢!
尝试的数据模型 -
编辑 - 抱歉没有指定我想要的答案。实体如下:
我目前有 -
public class Farm : IEntityBase<int>
{
public int Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public ICollection<Field> Fields { get; set; }
public DateTime CreationTime { get; set; }
public ICollection<Harvest> Harvests { get; set; }
public Farm()
{
CreationTime = DateTime.Now;
}
}
public class Crop : IEntityBase<int>
{
public int Id { get; set; }
public DateTime CreationTime { get; set; }
public string CropName { get; set; }
public Crop()
{
CreationTime = DateTime.Now;
}
}
public class Field : IEntityBase<int>
{
public int Id { get; set; }
public string Name { get; set; }
public int FieldId { get; set; }
public DateTime CreationTime { get; set; }
public int FieldSize { get; set; }
public ICollection<Crop> Crops { get; set; }
public Field()
{
CreationTime = DateTime.Now;
}
}
public class Harvest:IEntityBase<int>
{
public int Id { get; set; }
public DateTime CreationTime { get; set; }
public int FarmId { get; set; }
public DateTime HarvestYear { get; set; }
public Crop Crop { get; set; }
public Harvest()
{
CreationTime = DateTime.Now;
HarvestYear = DateTime.Now;
}
}
解决方案
推荐阅读
- git - 在 mv 而不是 git mv 之后从源中删除文件
- c# - EF Core Automapper 递归查询
- spring-boot - Spring 自定义存储库 JpaEntityInformation
- asp.net - ASP.NET Boilerplate Angular 编译错误
- android - Flutter webview 文本选择句柄颜色
- c# - grpc服务器端口共享
- html - 如何使用带有 Bootswatch 主题的字形/图标?
- python - cloudcraper.exceptions.CloudflareChallengeError:检测到 Cloudflare 版本 2 挑战。当我将 cloudcraper 模块与 python 一起使用时出错
- android - 不断收到 java.io.InterruptedIOException: Retrofit2 中的超时
- java - 长期任务的弹性模式