mauriziopatino
mauriziopatino
CC#
Created by mauriziopatino on 1/2/2024 in #help
WPF Visibility binding seems that is not setting style
No description
11 replies
CC#
Created by mauriziopatino on 11/22/2023 in #help
ASP.NET Don't clean form after error validation
Hi, i have a GET method called Create() where just display the Create View public IActionResult Create() and a POST method called Store() where just store all the values from Create view form public async Task<IActionResult> Store(ViewModel vm) How can I return a Redirect to "Create" View without loosing form data after Fluent Validation error? All is working correctly, the problem is that when I returned to my "Create" view I loose all the form information
3 replies
CC#
Created by mauriziopatino on 8/21/2023 in #help
❔ Entity Framework 7 model property as enum is giving conflicts when running migration
I'm trying to create a many to many "pivot" model where it haves 2 fields "GroupId" and "SubscriptionId"
public class GroupSubscription
{
public int Id { get; set; }
public int GroupId { get; set; }
public SubscriptionType SubscriptionId { get; set; }
public Group Group { get; set; } = null!;
public Subscription Subscription { get; set; } = null!;

}
public class GroupSubscription
{
public int Id { get; set; }
public int GroupId { get; set; }
public SubscriptionType SubscriptionId { get; set; }
public Group Group { get; set; } = null!;
public Subscription Subscription { get; set; } = null!;

}
I have a SubscriptionType enum:
public enum SubscriptionType
{
Basic = 1,
}
public enum SubscriptionType
{
Basic = 1,
}
When i run the migration it gives me this warnings: "The foreign key property 'GroupSubscription.SubscriptionId1' was created in shadow state because a conflicting property with the simple name 'SubscriptionId' exists in the entity type, but is either not mapped, is already used for another relationship, or is incompatible with the associated primary key type. See https://aka.ms/efcore-relationships for information on mapping relationships in EF Core."
19 replies