Click here to Skip to main content
14,607,267 members

.NET (Core and Framework)

 
GeneralRe: c# forms (holy crap i'm not ready for this) Pin
Uranium-23515-Mar-20 7:40
MemberUranium-23515-Mar-20 7:40 
GeneralRe: c# forms (holy crap i'm not ready for this) Pin
Richard MacCutchan15-Mar-20 8:00
mveRichard MacCutchan15-Mar-20 8:00 
AnswerRe: c# forms (holy crap i'm not ready for this) Pin
Uranium-2359-Apr-20 23:01
MemberUranium-2359-Apr-20 23:01 
GeneralRe: c# forms (holy crap i'm not ready for this) Pin
Uranium-23510-Apr-20 10:12
MemberUranium-23510-Apr-20 10:12 
GeneralRe: c# forms (holy crap i'm not ready for this) Pin
Uranium-23511-Apr-20 16:33
MemberUranium-23511-Apr-20 16:33 
QuestionEntity Framework Code First is generating an extra column - need some help please Pin
simpledeveloper9-Mar-20 9:44
Membersimpledeveloper9-Mar-20 9:44 
AnswerRe: Entity Framework Code First is generating an extra column - need some help please Pin
Uranium-2359-Mar-20 14:13
MemberUranium-2359-Mar-20 14:13 
AnswerRe: Entity Framework Code First is generating an extra column - need some help please Pin
Richard Deeming10-Mar-20 0:55
mveRichard Deeming10-Mar-20 0:55 
The conventions don't understand that you wanted UserId to be the foreign-key column for the ApplicationUser navigation property.

As a result, EF assumes that UserId is just a standard string column, which is not connected to anything. It added the ApplicationUser_Id column to serve as the foreign-key link for the ApplicationUser navigation property.

Code First Conventions - EF6 | Microsoft Docs[^]

For the conventions to work, you'd either need to rename the UserId property to ApplicationUserId, or rename the ApplicationUser property to User.

If you can't rename either property, you need to use data annotations or the fluent API to configure your foreign key relationship correctly. For example:
[Required]
[Index("IX_UniqueConstraintCaseAssignedToInvestigator", 2, IsUnique = true)]
[MaxLength (128)]
[ForeignKey(nameof(ApplicationUser))] // <-- Add this attribute
public string UserId { get; set; }
public ApplicationUser ApplicationUser { get; set; }
Or:
modelBuilder.Entity<CaseAssignedToInvestigator>()
    .HasOne(case => case.ApplicationUser)
    .WithMany() // Or: .WithMany(user => user.Cases)
    .HasForeignKey(case => case.UserId);

Code First Data Annotations - EF6 | Microsoft Docs[^]
Fluent API - Relationships - EF6 | Microsoft Docs[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

QuestionBest way to remotely send/retrieve data (securely) Pin
Uranium-2357-Mar-20 15:03
MemberUranium-2357-Mar-20 15:03 
AnswerRe: Best way to remotely send/retrieve data (securely) Pin
Gerry Schmitz8-Mar-20 10:05
mveGerry Schmitz8-Mar-20 10:05 
GeneralRe: Best way to remotely send/retrieve data (securely) Pin
Uranium-2358-Mar-20 19:41
MemberUranium-2358-Mar-20 19:41 
QuestionSending email via .net core 3 using Worker Service Pin
ElenaRez25-Feb-20 4:00
MemberElenaRez25-Feb-20 4:00 
AnswerRe: Sending email via .net core 3 using Worker Service Pin
ZurdoDev25-Feb-20 4:25
mveZurdoDev25-Feb-20 4:25 
SuggestionRe: Sending email via .net core 3 using Worker Service Pin
Richard MacCutchan25-Feb-20 4:27
mveRichard MacCutchan25-Feb-20 4:27 
SuggestionRe: Sending email via .net core 3 using Worker Service Pin
Richard Deeming25-Feb-20 4:55
mveRichard Deeming25-Feb-20 4:55 
QuestionProblems with EntityFramwork - compatible Framework Database Driver not found?! Pin
ricardo188515-Feb-20 9:33
Memberricardo188515-Feb-20 9:33 
AnswerRe: Problems with EntityFramwork - compatible Framework Database Driver not found?! Pin
Gerry Schmitz15-Feb-20 9:52
mveGerry Schmitz15-Feb-20 9:52 
QuestionClosing and Disposing Excel Application Process in C# Pin
Pramod_Kumar14-Feb-20 4:26
MemberPramod_Kumar14-Feb-20 4:26 
AnswerRe: Closing and Disposing Excel Application Process in C# Pin
Richard Deeming4-Feb-20 4:37
mveRichard Deeming4-Feb-20 4:37 
Questionconverting text file data from string to X,Y,Z coordinates Pin
Sher Shah 11-Feb-20 3:32
MemberSher Shah 11-Feb-20 3:32 
AnswerRe: converting text file data from string to X,Y,Z coordinates Pin
Pete O'Hanlon1-Feb-20 4:10
subeditorPete O'Hanlon1-Feb-20 4:10 
GeneralRe: converting text file data from string to X,Y,Z coordinates Pin
Sher Shah 11-Feb-20 5:11
MemberSher Shah 11-Feb-20 5:11 
GeneralRe: converting text file data from string to X,Y,Z coordinates Pin
phil.o1-Feb-20 6:28
mvephil.o1-Feb-20 6:28 
QuestionApplication wide information into classes in referenced DLL's Pin
A D Rosser28-Jan-20 4:22
MemberA D Rosser28-Jan-20 4:22 
AnswerRe: Application wide information into classes in referenced DLL's Pin
Richard Deeming28-Jan-20 4:32
mveRichard Deeming28-Jan-20 4:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.