You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Open
it-copilot4 opened this issue
May 12, 2024
· 6 comments
}
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:
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.
The bulksave mode is by default you don't need to mention it explicitly.
What is the result that is returned by the ExecuteAsync method?
If it fails, you should have every information about the failure. Checking the result is documented on the website.
________________________________
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: ***@***.***>
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: