Database 更新数据库架构以允许多个用户
我正在开发一个ASP.net Web API应用程序,希望允许多个用户访问自己的数据,而无需对数据库模式进行太多更改 我的桌子看起来有点像这样:Database 更新数据库架构以允许多个用户,database,asp.net-web-api,entity-framework-6,schema,Database,Asp.net Web Api,Entity Framework 6,Schema,我正在开发一个ASP.net Web API应用程序,希望允许多个用户访问自己的数据,而无需对数据库模式进行太多更改 我的桌子看起来有点像这样: public class Asset { public string Name { get; set; } [Required] public int Id { get; set; } public string AssetTag { g
public class Asset
{
public string Name { get; set; }
[Required]
public int Id { get; set; }
public string AssetTag { get; set; }
public string Serial { get; set; }
public int Model { get; set; }
}
public class Organisation
{
[Required]
public int Id { get; set; }
[Required]
public int DefaultLocation { get; set; }
public location Location { get; set; }
public string Name { get; set; }
public string Phone { get; set; }
public string Contact { get; set; }
}
public class AssetModel
{
public string Name { get; set; }
[Required]
public int Id { get; set; }
public int CategoryId { get; set; }
public int ManufacturerId { get; set; }
public string ModelNumber { get; set; }
}
*为简洁起见省略字段
每个用户应能够创建自己的资产/组织/等,但不得访问任何其他用户字段
我尚未添加授权/身份验证,但我可能会使用基于令牌的身份验证,如下所述:
这是否应该像将每个用户的GUID添加到每列并应用一些逻辑一样简单?或者我需要完全重新设计数据库吗?向实体添加关于它所属实体的信息是可以的,让它只是一个字符串或
用户
实体(如果您需要关于用户的其他信息)。向实体添加关于它所属实体的信息是可以的,让它只是一个字符串或用户
实体(如果您需要有关用户的其他信息)。