-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug--When I save an entity with a primary key of guid to the database using the EfCoreSave method, an error occurs, prompting me to "Cannot insert value NULL into column 'Id', table 'SimpleTutorial. dbo. Author'; columns do not allow null values. UPDATE fails." When I change the insertion mode to SaveMode.EntityFrameworkCore Successfully save #483
Comments
@paillave is this a bug of SaveMode.SqlServerBulk |
Hello, for me its not saving at all when specifying SaveMode.SqlServerBulk Im using the latest prerelease version. @paillave Is this project abandoned or are you lacking help spomehow to make it progress ?? |
Hello, the project is not abandoned at all. I'm making essential maintenance for the moment. I'm planning a big chunk of essential changes for a version 3.0. |
Hi, good to know, waiting for 3.0 to come soon ! For me, it simply returns without issues/errors when bulk mode is specified. |
Hi Steph, there seem to be a package conflict when using etl.net from a .net 8 solution targeting microsoft.entityframeworkcore 8.0.6 thats the error Method not found: 'System.Nullable`1<Microsoft.EntityFrameworkCore.Metadata.StoreObjectIdentifier> Microsoft.EntityFrameworkCore.Metadata.StoreObjectIdentifier.Create(Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType, Microsoft.EntityFrameworkCore.Metadata.StoreObjectType)'. migrating etl.net to .net 8 and using latest versions of the above fixes it. bulk saving works flawlessly after that |
We are working on net8 migration these days. Hopefully we will be able to release it soon.
Stéphane.
…________________________________
From: Mourad57 ***@***.***>
Sent: Sunday, July 7, 2024 12:20:46 PM
To: paillave/Etl.Net ***@***.***>
Cc: Stéphane Royer ***@***.***>; Mention ***@***.***>
Subject: Re: [paillave/Etl.Net] Bug--When I save an entity with a primary key of guid to the database using the EfCoreSave method, an error occurs, prompting me to "Cannot insert value NULL into column 'Id', table 'SimpleTutorial. dbo. Author'; columns do not a...
Hi Steph,
there seem to be a package conflict when using etl.net from a .net 8 solution targeting microsoft.entityframeworkcore 8.0.6
thats the error
Method not found: 'System.Nullable`1<Microsoft.EntityFrameworkCore.Metadata.StoreObjectIdentifier> Microsoft.EntityFrameworkCore.Metadata.StoreObjectIdentifier.Create(Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType, Microsoft.EntityFrameworkCore.Metadata.StoreObjectType)'.
migrating etl.net to .net 8 and using latest versions of the above fixes it.
bulk saving works flawlessly after that
—
Reply to this email directly, view it on GitHub<#483 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABDFY2GFRBNV47XJXCYFMB3ZLEI75AVCNFSM6AAAAABHSKRPZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJSGM4TQOJTGU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I tryed many times. the result always faild and return error information belowe(I use .net 8 and 7.18 EFCore,it seems the EF Save don't support GUID Primary Key): |
Example Code
public class Author
{
public Guid Id { get; set; }
public string Email { get; set; }
public string Name { get; set; }
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
var authorBuilder = modelBuilder.Entity();
authorBuilder.ToTable(nameof(Author));
authorBuilder.HasKey(i => i.Id);
authorBuilder.HasIndex(i => i.Email).IsUnique();
authorBuilder.Property(i => i.Id).HasDefaultValueSql("NEWID()");
authorBuilder.Property(i => i.Name).IsRequired();
authorBuilder.Property(i => i.Email).HasMaxLength(250).IsRequired();
}
var authorStream = rowStream
.Distinct("remove author duplicates based on emails", i => i.Author)
// .Select("create author instance", i => new Author { Email = i.Email, Name = i.Author })
.EfCoreSave("save authors", o => o
.Entity(i => new Author {Id=Guid.NewGuid(), Email = i.Email, Name = i.Author })
.SeekOn(i => i.Name)
//.AlternativelySeekOn(i => i.Name)
.WithMode(SaveMode.SqlServerBulk));
The text was updated successfully, but these errors were encountered: