Created
June 13, 2019 16:11
-
-
Save FrankDupree/382fce6bba40b87e5be95256569f10dd to your computer and use it in GitHub Desktop.
EntityFramework foreign key conflicts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Status : Entity, IAggregateRoot | |
{ | |
public string IdentityGuid { get; private set; } | |
public string Content { get; set; } | |
public string UserId { get; set; } | |
public int NetLikeCount { get; set; } | |
public readonly List<StatusLike> _statusLikes; | |
public IReadOnlyCollection<StatusLike> StatusLikes => _statusLikes; | |
public readonly List<Photo> _photos; | |
public IReadOnlyCollection<Photo> Photos => _photos; | |
public readonly List<Video> _videos; | |
public IReadOnlyCollection<Video> Videos => _videos; | |
public DateTime Created { get; set; } | |
public DateTime Edited { get; set; } | |
protected Status() | |
{ | |
_statusLikes = new List<StatusLike>(); | |
_photos = new List<Photo>(); | |
_videos = new List<Video>(); | |
} | |
public Status(string content, string userId, int netLikeCount=0) :this() | |
{ | |
Content = content; | |
UserId = userId; | |
NetLikeCount = netLikeCount; | |
Created = DateTime.UtcNow; | |
} | |
} | |
public class Photo : Entity, IAggregateRoot | |
{ | |
public int Album_Id { get; set; } | |
public string UserId { get; set; } | |
public string Name { get; set; } | |
public string Type { get; set; } | |
public int TypeId { get; set; } | |
public string Description { get; set; } | |
public string Content_Type { get; set; } | |
public string Filename { get; set; } | |
public long Size { get; set; } | |
public string Thumbnail { get; set; } | |
public string Url { get; set; } | |
public int Width { get; set; } | |
public int Height { get; set; } | |
public DateTime Created { get; set; } | |
public DateTime Edited { get; set; } | |
} | |
public class Video : Entity, IAggregateRoot | |
{ | |
public string UserId { get; set; } | |
public string Name { get; set; } | |
public string Type { get; set; } | |
public int TypeId { get; set; } | |
public string Description { get; set; } | |
public string Content_Type { get; set; } | |
public string Filename { get; set; } | |
public string Url { get; set; } | |
public long Size { get; set; } | |
public DateTime Created { get; set; } | |
public DateTime Edited { get; set; } | |
} | |
public class Log : Entity, IAggregateRoot | |
{ | |
public string IdentityGuid { get; private set; } | |
public string Content { get; set; } | |
public string UserId { get; set; } | |
public int Day { get; set; } | |
public string Title { get; set; } | |
public int NetLikeCount { get; set; } | |
public readonly List<LogLike> _logLikes; | |
public IReadOnlyCollection<LogLike> LogLikes => _logLikes; | |
public readonly List<Photo> _photos; | |
public IReadOnlyCollection<Photo> Photos => _photos; | |
public readonly List<Video> _videos; | |
public readonly List<Sound> _audios; | |
public IReadOnlyCollection<Video> Videos => _videos; | |
public IReadOnlyCollection<Sound> Audios => _audios; | |
public DateTime Created { get; set; } | |
public DateTime Edited { get; set; } | |
protected Log() | |
{ | |
_logLikes = new List<LogLike>(); | |
_photos = new List<Photo>(); | |
_videos = new List<Video>(); | |
_audios = new List<Sound>(); | |
} | |
public Log(string content, string userId, int netLikeCount=0) :this() | |
{ | |
Content = content; | |
UserId = userId; | |
NetLikeCount = netLikeCount; | |
Created = DateTime.UtcNow; | |
} | |
} | |
public class Sound : Entity, IAggregateRoot | |
{ | |
public string UserId { get; set; } | |
public string Name { get; set; } | |
public string Type { get; set; } | |
public int TypeId { get; set; } | |
public string Description { get; set; } | |
public string Content_type { get; set; } | |
public string Filename { get; set; } | |
public string Url { get; set; } | |
public long Size { get; set; } | |
public DateTime Created { get; set; } | |
public DateTime Edited { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment