logo
down
shadow

MySqlParameter type conflict when using Entity Framework with Pomelo


MySqlParameter type conflict when using Entity Framework with Pomelo

By : AJ Tech
Date : November 21 2020, 04:01 AM
will be helpful for those in need Pomelo is using MySqlConnector instead of Oracle’s own package. The benefits of this are outlined on the MySqlConnector project site:
Why use MySqlConnector over Oracle’s Connector/NET?
code :


Share : facebook icon twitter icon
Entity Framework 4.1 : The navigation property 'BusinessUser' declared on type 'Login' has been configured with conflict

Entity Framework 4.1 : The navigation property 'BusinessUser' declared on type 'Login' has been configured with conflict


By : justin He
Date : March 29 2020, 07:55 AM
I hope this helps you . I am having two entities , Your BusinessUser must have relation configured as:
code :
this.HasOptional(bu => bu.LoginInfo)
    .WithRequired(l => l.BusinessUser);
Entity framework Code First multiple mappings of one entity type inside of another entity type

Entity framework Code First multiple mappings of one entity type inside of another entity type


By : Engaung Zhang
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I was able to figure this out after sleeping on it. So for anyone else that runs into a similar situation here's the new code.
code :
// No change to this class
pubic class Question
{
    public virtual List<QuestionAnswerOption> AvailableQuestionAnswerOptions { get; set; }
    public Question RequiredPrerequisiteQuestion { get; set; }
    public virtual List<QuestionAnswerOption> AcceptablePrerequisiteQuestionAnswerOptions { get; set; }
}

// Added second collection of Question, PreRequisiteQuestions
public class QuestionAnswerOption
{
    public int Index { get;set; }
    public string Value { get;set; } // this may be 'Yes', 'No', 'Maybe', 'Don't Know', etc.
    public virtual List<Question> Questions { get; set; }
    public virtual List<Question> PreRequisiteQuestions { get; set; }
}

// then inside of our database context class we have the following
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);

    modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
    modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();

    modelBuilder.Entity<Question>().HasMany(x =>
        x.AvailableQuestionAnswerOptions).WithMany(y => y.Questions)
        .Map(m =>
        {
            m.MapLeftKey("Question_ID");
            m.MapRightKey("QuestionAnswerOption_ID");
            m.ToTable("AvailableQuestionAnswerOptionMap");
        });

    // changed this to use the new PreRequisiteQuestions collection
    modelBuilder.Entity<Question>().HasMany(x =>
        x.AcceptablePrerequisiteQuestionAnswerOptions).WithMany(y => y.PreRequisiteQuestions )
        .Map(m =>
        {
            m.MapLeftKey("Question_ID");
            m.MapRightKey("QuestionAnswerOption_ID");
            m.ToTable("AcceptableQuestionAnswerOptionMap");
        });
}
Entity Framework conflict while adding row

Entity Framework conflict while adding row


By : h0rus
Date : March 29 2020, 07:55 AM
To fix this issue Sound like you are trying to add a record with a foreign key that allready exists or trying to add a value in de identifier column while the identifier will automaticly be filled by the database.
Have you set your keys properly on both sides? Can you post the code that goes wrong?
Mapping conflict Entity Framework

Mapping conflict Entity Framework


By : user2412236
Date : March 29 2020, 07:55 AM
To fix the issue you can do Below is the fix, I removed the navigation property on the other side of the relationship using WithMany()
Add BlogId and MessageId to Message and Blog tables
code :
HasOptional(t => t.LastMessage).WithMany().HasForeignKey(d => d.MessageId);

// Relationships
HasOptional(t => t.LastMessage)
          .WithRequired(t => t.Blog)
          .Map(t => t.MapKey("LastMessageId"));
HasOptional(t => t.Blog).WithMany().HasForeignKey(d => d.BlogId);

// Relationships
 HasRequired(t => t.Blog)
            .WithOptional()
            .Map(t => t.MapKey("BlogId"));
Can I use Pomelo.EntityFrameworkCore.MySql with .NET Framework 4.x?

Can I use Pomelo.EntityFrameworkCore.MySql with .NET Framework 4.x?


By : user3171440
Date : March 29 2020, 07:55 AM
wish help you to fix your issue The Pomelo/MySqlConnector solution can indeed be used with .NET Framework. As P. Kanavos says, the hard part is having to switch to EF Core. That also works with .NET Framework, but is significantly different from EF 6.x. If your use of EF is straightforward, the change should not be overly difficult. In my application, though, the design was heavily dependent on EF6 functionality that is not present in EF Core. (Specifically, chained inclusions of linked entities, including through collections.) Also, we were composing expressions that represented the queries (with inclusions) in one class, and passing those through another class into the repository. That flow doesn't work nicely with EF Core's fluent composition of queries.
In the end, we wound up moving our database to MS SQL Server instead. But for a more conventional use of Entity Framework, it is feasible to switch to EF Core + Pomelo + MySqlConnector.
Related Posts Related Posts :
  • Linq to object Multiple Where short circuit evaluation
  • WPF - Create solid layout without designer
  • View not rendering on NET Core
  • Proper way to create domain models and viewmodels in microservices
  • StaticInjectorError(AppModule)[AuthGuard] after login
  • Getting Entity Model dynamically based on TableName?
  • Customizing the Navigation Form after my form's confirmation dialog
  • CSHTML Confirm Delete prior to deleting database record
  • How to set property values for indexers using Expressions?
  • My Mandelbrot sketching program in c# isn't working
  • Best way to validate a date string in C#
  • Bot Framework v4 Bot emulator authentication bad request
  • Can I use MVC 5 remote validation to check for duplicate values, but exclude the item being edited?
  • How to get list of all databases using MongodbClient class. (C# application)
  • WPF DataGrid disable cell edit based on value
  • how to check if there are 4 or more spaces in streamread line
  • How to perform style changes on datagridview rows using rows from the underlying bindingsource?
  • How do I add a C# solution file in Jetbrains Rider?
  • Docker ASP.NET CORE 2.1 app in Visual Studio 2017. App does not start in debug mode
  • ASP.NET Core WebApi with SQL Server and EFCore 2
  • Sitefinity Widget User Control
  • MultiSelectList shows one value from the IEnumerable given to it with multiple values
  • Items in picker from a list - Xamarin Code behind
  • How can I insert/update a List<T> as member of an entity in SQLite?
  • How to "flush" ApplicationInsightsTraceListener, in a Console Application, on exit?
  • Named Pipes Between Winforms and Service Can Only Connect Once
  • Add CDATA to a Node Value in a loop
  • Custom serializer for just one property in Json.NET, without changing the model class
  • How to stop a timer/change system UI OnSleep Xamarin Android
  • LINQ parse xml file and get values from specific nodes
  • How do I set the time out for page load?
  • Clarification of IL generated code referenced to strings
  • EntityFrameworkCore.SQLLite and UWP Not behaving as expected
  • WPF MediaElement: Video opened twice
  • Temporary excel file with Interop library
  • Insert \u2265 into a C# string
  • Constant Enemy Damage to Player - Unity 2019.1 Beta
  • Is there a way to scan for viruses when downloading an attachment using EWS?
  • How to generify a method when T can be multiple new () Types?
  • Reading binary file data into List of Structs
  • Updating Status Strip on Form from BackgroundWorker
  • Visual Studio using GIT repository Publishing with API and Website in one Solution
  • Return Standard Deviation of column values with other column value condition LINQ
  • Grab a count of different values in object
  • c# File used by who?
  • How to parse string into an array using set number of characters in C#
  • How to sent list using CommandParameter
  • Problem with referencing ResourceDictionaries, and Styling across multiple assemblies
  • StackExchange Redis - high CPU usage on WriteAllQueues
  • Not typing the full variable name but partial name is represented by another string value
  • Linq to Entities Selecting Data with Max Date?
  • How to extract data using Ical.Net?
  • C# program crashes because listbox items change
  • Kicking a user in Discord.Net
  • C# Linq Find duplicates with multiple group by
  • How to call control on a Panel that is inside usercontrol
  • c# ReadAsJsonAsync in framework 4.5
  • Inner join two table variables and return an output cursor from an anonymous plsql block in a c# application
  • Notify consumers when all tasks have completed without blocking the thread
  • Replace "\\" with "\" in a path
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org