Git Product home page Git Product logo

zzzprojects / entityframework-extensions Goto Github PK

View Code? Open in Web Editor NEW
335.0 22.0 57.0 2.88 MB

Entity Framework Bulk Operations | Improve Entity Framework performance with Bulk SaveChanges, Insert, update, delete and merge for SQL Server, SQL Azure, SQL Compact, MySQL and SQLite.

Home Page: https://entityframework-extensions.net

C# 100.00%
entity-framework ef6 entityframework csharp dotnet sqlbulkcopy bulk-operation bulk-savechanges dotnet-core dotnet-standard

entityframework-extensions's Introduction

What's Entity Framework Extensions?

Entity Framework Extensions is a library that dramatically improves EF performances by using bulk and batch operations.

People using this library often report performance enhancement by 50x times and more!

Improve Entity Framework performance with Bulk SaveChanges and Bulk Operations

Solve Entity Framework performance issue when saving with high performance bulk operations and hundreds of flexibles feature.

  • BulkSaveChanges
  • BulkInsert
  • BulkUpdate
  • BulkDelete
  • BulkMerge
  • DeleteFromQuery
  • UpdateFromQuery
var context = new CustomerContext();
// ... context code ...

// Easy to use
context.BulkSaveChanges();

// Easy to customize
context.BulkSaveChanges(operation => operation.BatchSize = 1000);
// Perform specific bulk operations
context.BulkDelete(customers);
context.BulkInsert(customers);
context.BulkUpdate(customers);

// Customize Primary Key
context.BulkMerge(customers, operation => {
   operation.ColumnPrimaryKeyExpression = customer => customer.Code;
});
Scalable

SQL Server - Benchmarks

Operations 100 Rows 1,000 Rows 10,000 Rows
BulkSaveChanges 20 ms 200 ms 2,000 ms
BulkInsert 2 ms 6 ms 25 ms
BulkUpdate 27 ms 50 ms 80 ms
BulkDelete 25 ms 45 ms 70 ms
BulkMerge 30 ms 65 ms 160 ms
Extensible

Support Multiple SQL Providers:

  • SQL Server 2008+
  • SQL Azure
  • SQL Compact
  • MySQL
  • SQLite
  • PostgreSQL
  • Oracle

Download

Entity Framework Core (EF Core)

download

PM> Install-Package Z.EntityFramework.Extensions.EFCore

Entity Framework 6 (EF6)

download

PM> Install-Package Z.EntityFramework.Extensions

Entity Framework 5 (EF5)

download

PM> Install-Package Z.EntityFramework.Extensions.EF5

* PRO Version unlocked for the current month

BulkSaveChanges

Problem

You need to save hundreds or thousands of entities, but you are not satisfied with Entity Framework performance.

Solution

BulkSaveChanges is exactly like SaveChanges but performs way faster. It’s easy to use, you only need to replace “SaveChanges” by “BulkSaveChanges”, and you are done!

// Upgrade SaveChanges performance with BulkSaveChanges
var context = new CustomerContext();
// ... context code ...

// Easy to use
context.BulkSaveChanges();

// Easy to customize
context.BulkSaveChanges(operation => operation.BatchSize = 1000);
Scalability

BulkSaveChanges is as fast as SaveChanges with one entity and quickly become 10-50x faster with hundreds and thousands of entities.

Bulk Operations

Problem

You need even more performance than BulkSaveChanges, save detached entities or save entities in a specific order.

Solution

Use bulk operations such as bulk insert, update, delete and merge which perform operations on specified entities and bypass the change tracker to increase performance.

// Perform specific bulk operations on entities
context.BulkDelete(customers);
context.BulkInsert(customers);
context.BulkUpdate(customers);
context.BulkMerge(customers);
Maintainability

Bulk Operation directly uses the Entity Framework Model. Even if you change column name or change inheritance (TPC, TPH, TPT), Bulk Operation will continue to work as expected.

Custom Key

Problem

You need to perform an update, delete, or merge using a specific custom key like the custom code.

Solution

Specify your own key by customizing the operation.

// Use flexible features such as specifying the primary key
context.BulkMerge(customers, operation => {
   operation.ColumnPrimaryKeyExpression = customer => customer.Code;
});
Flexibility

Bulk operations offer hundreds of customization such as BatchSize, Custom Key, Custom Mapping, etc.

PRO Version

PRO Version unlocked for the current month

Features PRO Version
Bulk SaveChanges Yes
Bulk Insert Yes
Bulk Update Yes
Bulk Delete Yes
Bulk Merge Yes
DeleteFromQuery Yes
UpdateFromQuery Yes
Commercial License Yes
Royalty-Free Yes
Support & Upgrades (1 year) Yes
Learn more about the PRO Version

Contribute

The best way to contribute is by spreading the word about the library:

  • Blog it
  • Comment it
  • Star it
  • Share it

A HUGE THANKS for your help.

More Projects

To view all our free and paid projects, visit our website ZZZ Projects.

entityframework-extensions's People

Contributors

jonathanmagnan avatar lempireqc avatar mariloutb avatar stgelaisalex avatar waqasm78 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

entityframework-extensions's Issues

BUlkInsert into inherited class causes the following error

Exception of type 'EntityFramework.MappingAPI.Exceptions.ParentNotMappedYetException' was thrown.
at EntityFramework.MappingAPI.Mappers.CodeFirstMapper.PrepareMapping(String typeFullName, EdmType edmItem) in c:\dev\EntityFramework.MappingAPI\trunk\src\EntityFramework.MappingAPI\Mappers\CodeFirstMapper.cs:line 51}

Error: No unique index has been found with your primary keys. SQL Compact require a primary key containing in an index.

Hello guys,

you can see my errormessage at the top of my message. I really don't know what I have to do. At the moment, my code looks something like this:

My class:

public class TestClass
{
        [Key]
        public int Id { get; set; }

        [Index("PkIndex",1,IsUnique = true)]
        [Column("Item No_", Order = 0)]
        public string Item_No_ { get; set; }

        [Index("PkIndex",2, IsUnique = true)]
        [Column("Sales Type", Order = 1)]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int Sales_Type { get; set; }
}

Now I have a List of TestClass-Objects and I want to do a BulkMerge with this function:

public void BulkInsertOrUpdate<T>(List<T> entities, int batchSize,Expression<Func<T,object>> primaryKeyExpression,  bool saveChanges = true) where T : class
{
        _context.BulkMerge(entities, operation =>
        {
            operation.BatchSize = batchSize;
            operation.ColumnPrimaryKeyExpression = primaryKeyExpression;
         });
         if (saveChanges)
         {
            BulkSaveChanges(batchSize);
         }
}

The call to the function looks like this:
BulkInsertOrUpdate(entities, 1000, tc => new {tc.Item_No_,tc.Sales_Type});

The error occur at the line _context.BulkMerge(entities, operation => .......).

I know (or I think) the reason for the error are my indexes on my table, but I don't know how to change my modelclass.

Kind regards

Rene

DeleteFromQuery on Oracle and DevArt

Hi!

I'm trying to use DeleteFromQuery with Oracle and DevArt, but the exception is thrown.
I understand this occurred because the schema is not included in SQL command.
It's is possible to include?

Thanks

Expose generated SQL for profiling purposes.

In vanilla Entity Framework you can call ToString to view the SELECT statement that Entity Framework generates behind the scenes. Entity Framework also allows logging SQL statements through context.Database.Log. This can be useful when refactoring LINQ queries, to see how your changes impact the generated SQL statement.

With this library's extensions, such as BulkUpdate and UpdateFromQuery, this does not appear to be possible.

DbContextExtensions.UpdateFromQuery() not escaping SQL Server reserved words

                DB.UpdateFromQuery<ResellerPriceList>(
                    e => some predicate, 
                    e => new ResellerPriceList { Default = false });

This code crashes:

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at \u0003.\u0001.\u0001(SqlCommand \u0002, BulkOperation \u0003, Int32 \u0004)\r\n   at \u0003.\u0001.\u0001(DbCommand \u0002, BulkOperation \u0003, Int32 \u0004)
at \u0003.\u0001.\b(\u0001 )
at \u0007.\u0002.\u0001(List`1 )
at \u001a.\u0002.\u0001(List`1 )
at \u001a.\u0006.\u0001(BulkOperation )
at Z.BulkOperations.BulkOperation`1.\u0001(IQueryable , IQueryable , Expression`1 )
at DbContextExtensions.UpdateFromQuery[TEntity](IQueryable`1 query, Expression`1 updateExpression, Action`1 bulkOperationFactory)
at DbContextExtensions.UpdateFromQuery[TEntity](IQueryable`1 query, Expression`1 updateExpression)
at DbContextExtensions.\u001e.\u0001()
at System.Threading.Tasks.Task.Execute()

SQL Profiler shows that it generates the following query:

exec sp_executesql N'MERGE INTO [dbo].[ResellerPriceLists] AS DestinationTable
USING
(
SELECT 
    1 AS [C1], 
    [Extent1].[Id] AS [Id]
    FROM [dbo].[ResellerPriceLists] AS [Extent1]
) AS StagingTable
ON StagingTable.Id = DestinationTable.Id
WHEN MATCHED THEN
    UPDATE
    SET     Default = @zzzupdate_1
;',N'@zzzupdate_1 bit',@zzzupdate_1=0

which is incorrect as Default should be escaped with [].

UpdateFromQuery: Incorrect syntax near ';'.

Are one-to-many relationships, EF's navigation properties, and aggregate functions, supported? I'm currently trying something like this:

Context.Users.UpdateFromQuery(u => new User {
    RoleCount = u.Roles.Count()
});

But this throws an SqlException with the following message:

UpdateFromQuery: Incorrect syntax near ';'.

Question: Batch Updates with DB Operations

Hi guys,

I am look for a good lybrary for EF Batch Operations.

I have a quick question, which I didn't find as an answer on Your Wikis.:

Does Your library supports operation of followed example:

Let's say I have a class:
public class Foo
{
public int Id { get; set; }
public int Sort { get; set; }
public string Name { get; set; }
}

Can I make with Your library some operations like this (Increment):
context.Foo.Where(e => e.Id == 123).Update(e => new Foo { Sort = Sort + 1 });
which is equal to MySQL:
UPDATE foo WHERE id=123 SET sort=sort+1;

and this like:
context.Foo.Update(e => new Foo { Name = Name.Replace("abc", "def") });
which is equal to MySQL:
UPDATE foo SET name=REPLACE(name, 'abc', 'def');

bulkInsert Cannot extract property name

(Free BulkInsert)

public class TakipBilgisiListDvo
{
public int Id { get; set; }
public string TakipNo { get; set; }
public string GrupTuru { get; set; }
public string GrupAdi { get; set; }
public double ToplamTutar { get; set; }
public TakipBilgisiEvraklar TakipBilgisiEvraklar { get; set; }
}

Code:

TakipBilgisiEvraklar evrakBilgisi = new TakipBilgisiEvraklar()
{
TesisKodu = Program.MedulaKullaniciAktif.TesisKodu,
EvrakRefNo = Convert.ToInt32(TbEvrakNo.Text),
BasTarihi = DateTime.Today,
BitTarihi = DateTime.Today,
Kurumu = "??"
};
dbase.TakipBilgisiEvraklar.Add(evrakBilgisi);
dbase.SaveChanges();

var tempListe = kesinSonuc.takipBilgisiListDVO.Select(x => new TakipBilgisiListDvo()
{
	TakipNo = x.takipNo,
	GrupAdi = x.grupAdi,
	GrupTuru = x.grupTuru,
	ToplamTutar = x.toplamTutar,
	TakipBilgisiEvraklar = evrakBilgisi    ??????
});
dbase.BulkInsert(tempListe);

??????: This feature gives " Cannot extract property name TakipBilgisiEvraklar_Id." error when doing bulkinsert operation. I need to follow a path that is interesting with this.

image

thank you

Error for BulkUpdate with ColumnInputeExpression and complex type

Hello,

We are not able to use BulkUpdate with ColumnInputExpression for Completype properties. Below you can find test which should pass - but code throw exception "Additional information: An error occured while resolving ColumnInput expression. See the inner exception for details.". Please note that if we do not use ColumnInputExpression than everything works.

public class EFContext : DbContext
{
    public EFContext(string nameOrConnectionString) : base(nameOrConnectionString)
    {
    }

    public DbSet<TestItem> TestItems { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.ComplexType<OptimisticLock>().Property(a => a.Value).HasColumnName("OptimisticLock");
    }
}

public class TestItem
{
    public TestItem()
    {
        Lock = new OptimisticLock();
    }

    [Key]
    public int Id { get; set; }
    public string Name { get; set; }
    public OptimisticLock Lock { get; set; }
}

public class OptimisticLock
{
    public int Value { get; set; }
}

[TestClass]
public class BatchUploadTests
{
    string connectionString = "connectionString";

    [TestMethod]
    public void BulkUpdate_ComplexTypePropertyInColumnInputExpression_ShouldPass()
    {
        EFContext context = new EFContext(connectionString);
        List<TestItem> items = GetTestItems(context);
        Action<EntityBulkOperation<TestItem>> bulkOperationFactory = sett =>
        {
            sett.ColumnInputExpression = a => new { a.Id, a.Lock};
        };
        context.BulkUpdate(items, bulkOperationFactory);
    }

    List<TestItem> GetTestItems(EFContext context)
    {
        List<TestItem> result = context.TestItems.Take(5).ToList();
        if (result.Count == 0)
        {
            CreateItems();
            result = context.TestItems.Take(5).ToList();
        }

        return result;
    }

    void CreateItems()
    {
        using (EFContext context = new EFContext(connectionString))
        {
            List<TestItem> tempInsertList = new List<TestItem>();
            for (int i = 0; i < 100; i++)
            {
                TestItem item = new TestItem()
                {
                    Name = "Name" + i
                };
                tempInsertList.Add(item);
            }
            context.TestItems.AddRange(tempInsertList);
            context.SaveChanges();
        }
    }
}

Exception thrown when ConcurrencyToken is declared

I have an entity mapping declared as follows:

modelBuilder.Entity<Customer>()
    .Property(c => c.Version)
    .IsConcurrencyToken();

A bulk of entities is modified or inserted do EF context. When context.BulkSaveChanges() is called I get an exception The column 'Version' was specified multiple times for 'StagingTable'. Full exception stack trace: https://pastebin.com/LVNhMGDB. Renaming property name does not help.

Bulk Operations / ChangeTracker / Soft Delete

Hi,

is there a possibility to intercept bulk entities to perform for example a soft delete (change delete status to update status) or change some information in created/updated bulk entities before executed in the database? The bulk entities are not reachable in DbContext.ChangeTracker().Entities(). Could you please show an example how to do that? Thanks!

` public class DbContextBase : DbContext
{
public override int SaveChanges()
{
this.ApplyConcepts()
return base.SaveChanges();
}

    protected override void ApplyConcepts()
    {
        var entries = this.ChangeTracker.Entries();

        if (entries != null)
        {
            foreach (var entry in entries)
            {
                switch (entry.State)
                {
                    case EntityState.Added:
                        this.ApplyCreationConcept(entry);
                        break;

                    case EntityState.Modified:
                        this.ApplyUpdateConcept(entry);
                        break;

                    case EntityState.Deleted:
                        this.ApplyDeletedConcept(entry);
                        break;
                }
            }
        }
    }

    protected virtual void ApplyCreationConcept(DbEntityEntry entry)
    {
        // entry.XXX = ....
    }

    protected virtual void ApplyDeletedConcept(DbEntityEntry entry)
    {
        // soft delete (change to update)
        entry.State = EntityState.Modified;
        entry.IsDeleted = true;
    }

    protected virtual void ApplyUpdateConcept(DbEntityEntry entry)
    {
        // entry.XXX = ....
    }
}`

Problem with tables with name "User" or "Group"

Hi

I have a database with about 20 tables. Your library works great for all tables except two of them. These tables are called User and Group. When trying to bulk insert data into these I get this message:

An error occured while retrieving the InformationSchemaTable information.

However if I rename the tables and corresponing classes to UserX and GroupX everything seems to work fine.

Could it be because User and Group also are SQL keywords?

Type not supported yet: ınt32

I am trying to perform bulk operations from LINQ Query without loading entities in the context.

                entities.PurchasingStepResult.Where(
                      ps => ps.PurchasingStepId == purchasingStepId)
                      .UpdateFromQuery(psr => new PurchasingStepResult { Status = true });

I am getting the error in the header text.I don't have inner exception at all.Stack trace gives the following path.

at . . (String )
at . . (Property )
at System.Collections.Generic.List1.ForEach(Action1 action)
at . . . (SchemaEntityType )
at System.Collections.Generic.List1.ForEach(Action1 action)
at . . (Schema , Boolean )
at . . (Schema , Boolean )
at . . (String , String , String )
at . . (DbContext )
at . . (DbContext )
at DbContextExtensions.GetModel(DbContext this)
at DbContextExtensions.UpdateFromQuery[TEntity](IQueryable1 query, Expression1 updateExpression, Action1 bulkOperationFactory) at DbContextExtensions.UpdateFromQuery[TEntity](IQueryable1 query, Expression`1 updateExpression)

Better explanation of versions

It would be nice to have more information about fixes what have been applied to new version.

Like:
FIXED: Issue with Database First && One to One Relationship

Good fix my current case. Sure there is internal project management behind and links to bug descriptions with fixes are not possible, but maybe little more than just one sentence?

By the way, good job with this extension. I use it for bulk operations and it makes my application usable.

A default DbContext context must exist, or a context factory must be provided (EntityFrameworkManager.ContextFactory). This setting is required for some additional features

Hi!
I'm trying to use BulkSaveChangesAsync together with EF Core (and Postgresql if that makes any difference) in an ASP.NET Core project.

I get the following error:
A default DbContext context must exist, or a context factory must be provided (EntityFrameworkManager.ContextFactory). This setting is required for some additional features

This is the package I use:
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="0.0.1-beta5" />

I have configured EF like this:

services
                .AddEntityFrameworkNpgsql()
                .AddDbContext<AppDataContext>(options =>
                {
                    options.UseNpgsql(connectionString);
                })
                .AddDbContext<DataContext>(options =>
                {
                    options.UseNpgsql(connectionString);
                });

I do not really understand the error message, how should I configure a default DbContext (as you can see I have multiple contexts). Or where should I provide the context factory?

Thank you!

what's the limt of FREE trial version

I want to know about EntityFramework-Extensions : what's the limit of FREE trial version? or if i still use the trial version, is there the time expiration limit ?
because i will using it in my production environment

Use BulkInsert,not support associated tables

eg:
qq 20160901104651

var tableAs = new List();
for (var i = 0; i < 1000; i++)
{
var tableB = new TableB { BName = "" };
var tableA = new TableA();
tableA.TableBs = new List();
tableA.TableBs.Add(tableB);
tableAs.Add(tableA);
}
BulkInsert(TableAs);

Only Insert TableA data,can't insert TableB data.
but this article https://www.infoq.com/news/2014/12/EF-Bulk-Operations has

This method supports all kinds of associations and entity types (TPC, TPH, and TPT).

Why is this?

Licence

I woul like to know how does the licence key work for 4 developpers
what happends if a developper leave the company
The licence iremain to the company or for the developper ?

License update doesn't work

Hi,

I have been using EF-extensions bulkinsert over the last few months (first major EF project) and it has always been working properly. Today I had to update to the latest version (3.9.44). Although the update was installed successfully, I get the following error message: {"The trial period is expired. Please buy a product license or go to http://www.zzzprojects.com and download the latest trial version."}.

I have tried to re-install several times but keep on getting the error message. I hope someone can help me to solve this issue.

Many thanks,

Paul

DeleteFromQuery and UpdateFromQuery SqlException

Primary key has bigint type and Identitiy specifications enabled is error.
but It was normal after changing int type.

What should I do?

Error Message Contents=>
위치: System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) 위치: System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
위치: System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
위치: System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
위치: System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
위치: System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
위치: System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite) 위치: System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
위치: System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
위치: �.�.�(SqlCommand �, BulkOperation �, Int32 �)
위치: �.�.�(DbCommand �, BulkOperation �, Int32 �)
위치: �.�.�(� )
위치: �.�.�(List1 ) 위치: �.�.�(List1 )
위치: �.�.�(BulkOperation )
위치: Z.BulkOperations.BulkOperation1.�(IQueryable , IQueryable ) 위치: DbContextExtensions.�[�](IQueryable1 , Action1 , CancellationToken ) 위치: DbContextExtensions.DeleteFromQuery[TEntity](IQueryable1 query, Action`1 bulkOperationFactory)

System.Data.SqlClient.SqlException:'The multi-part identifier "a.object_id" could not be bound'

BulkSaveChanges throws the following error:

System.Data.SqlClient.SqlException:'The multi-part identifier "a.object_id" could not be bound'

This could be due to the fact that my database is Case Sensitive as a sql trace reveals the failure occurs on the following query: query.txt

On line 77, the query is:

OR a.object_id = OBJECT_ID(E.base_object_name)

but it should be

OR A.object_id = OBJECT_ID(E.base_object_name)

Error with enums in relational entity into UpdateFromQuery

Hi,

When I try to filter from a relational enum, like this:

unitOfWork.Set<ClientContact>()
                    .Where(x => x.Client.Status == ClientsClientStatusEnum.Pending)
                    .UpdateFromQuery<ClientContact>(x => new ClientContact() { Code = "something" });

This try to update the Entity with this query:

exec sp_executesql N'MERGE INTO [Clients].[ClientContacts] AS DestinationTable
USING
(
SELECT 
    [Extent2].[StatusValue] AS [StatusValue], 
    [Extent1].[Id] AS [Id]
    FROM  [Clients].[ClientContacts] AS [Extent1]
    INNER JOIN [Clients].[Clients] AS [Extent2] ON [Extent1].[ClientId] = [Extent2].[Id]
    WHERE ([Extent2].[StatusValue] IN (3, 4))
) AS StagingTable
ON StagingTable.StatusValue = DestinationTable.StatusValue AND StagingTable.Id = DestinationTable.Id
WHEN MATCHED THEN
    UPDATE
    SET     [Code] = @zzzupdate_1
;',N',@zzzupdate_1 nvarchar(4)',@zzzupdate_1=N'something'

As you could show, it try to compare this enum into two different entities, because on stagingTable is from Clients and try to filter into ClientContacts

Strange issue with specific table

I have table "Manufacturing.ProductOrder" and this resolved with exception on BulkSaveChanges
Invalid object name 'ProductionOrder'.
What is the best way to figure out internal problems? LogDump? EF works nicely with my model, BulkSaveChanges have problems.

Random "underlying provider failed on Open" errors inside a transaction scope

In my code I open a transaction, run several .BulkUpdate steps and then .Complete() the transaction.
Generally it all works, but on random occasions it will crash on any one the steps involved (the crashing step seems to vary randomly).

Pseudocode::

var transactionOptions = new TransactionOptions
            {
                IsolationLevel = IsolationLevel.ReadCommitted,
                Timeout = TimeSpan.FromSeconds(600)
            };
using (var t = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
{
  // run bulkupdate 1
  // run bulkupdate 2
  // run bulkupdate 3
  // run bulkupdate 4, etc.
  t.Complete();
}

Any suggestions on why this happens?
I have attached a sample of one of the the exception stack traces below ...

Top-level Exception
Type: System.Data.Entity.Core.EntityCommandExecutionException
Message: An error occurred while executing the command definition. See the inner exception for details.
Source: EntityFramework
Additional:
ExpenseJob : CalculateExpenseJob: expense job Id:80562
FailedStep : UpdateNonAssetSalaryTypeForContribPercForExpenseJob failed
Duration : Duration in seconds: 9
Stack Trace: at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectQuery1.<>c__DisplayClass7.b__5()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func1 operation) at System.Data.Entity.Core.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) at System.Data.Entity.Core.Objects.ObjectQuery1..GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator1.MoveNext() at System.Linq.Lookup2.CreateForJoin(IEnumerable1 source, Func2 keySelector, IEqualityComparer1 comparer) at System.Linq.Enumerable.d__374.MoveNext()
at QMaster.BL.Entities.ExpenseCalcEntities.(IEnumerable1 ) at QMaster.BL.Entities.ExpenseCalcEntities.UpdateNonAssetSalaryTypeForContribPercForExpenseJob(Int32 expenseJobId) at QMaster.BL.Entities.ExpenseJobEntities.CalculateExpenseJob(ExpenseJob expenseJob, IUserData userData, Action1 progressDisplayText)
at A..(Object , ExpenseJob , IUserData , Action`1 )
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at (TaskAwaiter& )
at QMaster.ViewModel.ExpenseJobsViewModel..MoveNext()

Inner Exception 1
Type: System.Data.Entity.Core.EntityException
Message: The underlying provider failed on Open.
Source: EntityFramework
Stack Trace: at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction) at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func1 operation)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at QMaster.DAL.Helper.Interceptor.DatabaseLogger.Log[T](DbCommand command, DbCommandInterceptionContext1 interceptionContext) at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func3 operation, TInterceptionContext interceptionContext, Action3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)

Inner Exception 2
Type: System.Transactions.TransactionManagerCommunicationException
Message: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.
Source: System.Transactions
Stack Trace: at System.Transactions.Oletx.OletxTransactionManager.ProxyException(COMException comException)
at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)
at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx)
at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx)
at System.Transactions.EnlistableStates.Promote(InternalTransaction tx)
at System.Transactions.Transaction.Promote()
at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction)
at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts)
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx)
at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)
at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) at System.Data.SqlClient.SqlConnection.Open() at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action2 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed) at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.b__0() at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func1 operation)
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()

Inner Exception 3
Type: System.Runtime.InteropServices.COMException
Message: The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024)
Source: System.Transactions
Stack Trace: at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& transactionIdentifier, OletxTransactionIsolationLevel& isolationLevel, ITransactionShim& transactionShim)
at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)

InsertKeepIdentity in BulkInsert doesn't seem to work

Hi,
I'm having a problem where I need to bulk insert a large entity list where I have defined the identity ahead of time. Currently my code looks a little something like this:
db.BulkInsert(entityList, operation => { operation.SqlBulkCopyOptions = SqlBulkCopyOptions.KeepIdentity; operation.InsertKeepIdentity = true; });
This would seem to be the way to achieve this but I appear to be missing something crucial as it uses a from 0 incremented value instead.
If I run it with only 10 elements in entityList, I get the desired behaviour, so I'm assuming something different is going on behind the scenes for small collections.

Enabling FIPS Mode on Server 2012 R2 results in multiple failures

When using a licensed version of pro, the license validation will fail if FIPS mode is enabled on the machine with the following stack trace:
The program has encountered an unknown error: The provided license key is invalid or trial period is expired. Please buy a product license or go to http://www.zzzprojects.com and download the latest trial version. User: NEXTNET\bdunn Url: FPML Publish Exception Details: at �.�.�(String �, String �, Int32& �)
at �.�.�(ProviderType , Boolean )
at �.�.�(BulkOperation )
at Z.BulkOperations.BulkOperation.BulkInsert()
at �.�.�(List1 , Object , Dictionary2 )
at �.�.�()

When using the latest demo version on nuget (3.12.0), BulkInsert (and I assume the other bulk methods) fail with the following stack trace:

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Security.Cryptography.CryptoConfig.CreateFromName(String name, Object[] args)
at System.Security.Cryptography.MD5.Create()
at �.�.�(String )
at Z.BulkOperations.InternalLicenseManager.�(String �, String �, Int32& �)
at �.�.�(ProviderType , Boolean , Boolean )
at �.�.�(BulkOperation )
at Z.BulkOperations.BulkOperation.BulkInsert()
at Z.EntityFramework.Extensions.SqlServerBulkSaveChanges.�(List1 , Int32 , Object , Dictionary2 )
at Z.EntityFramework.Extensions.SqlServerBulkSaveChanges.�()

Inner Exception: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.
at System.Security.Cryptography.MD5CryptoServiceProvider..ctor()

OutOfMemoryException

Hello

I’am trying to uses z.ef to insert an xml file
It work fine for xml file size through 75 Mo
If the size is higher I have OutOfMemoryException exception.
Is it an limitation ou can I adjust a option to increase this limit ?

System.OutOfMemoryException: Une exception de type 'System.OutOfMemoryException' a été levée.
à System.Data.Common.StringStorage.SetCapacity(Int32 capacity)
à System.Data.RecordManager.set_RecordCapacity(Int32 value)
à System.Data.RecordManager.GrowRecordCapacity()
à System.Data.RecordManager.NewRecordBase()
à System.Data.DataTable.NewRecord(Int32 sourceRecord)
à System.Data.DataRow.BeginEditInternal()
à System.Data.DataRow.set_Item(DataColumn column, Object value)
à System.Data.DataRow.set_Item(String columnName, Object value)
à . . (List1 , Int32 , Object , Dictionary2 )
à . . ()
à DbContextExtensions.BulkSaveChanges(DbContext this, Boolean useEntityFrameworkPropagation, Action1 bulkOperationFactory) à DbContextExtensions.BulkSaveChanges(DbContext this, Action1 bulkOperationFactory)

IncludeOptimized skips our cache TransactionInterceptor and Provider

We are using a custom, multi-tenant implementation of EFCache (https://efcache.codeplex.com/) as our cache provider for memory and Redis. Since we added EF-Plus, and in particular IncludeOptimized, we noticed that caching no longer works.

EFCache seems to skip the TransactionInterceptor and Provider pipeline used by EFCache.

As far as I can tell, the following section in EF-Plus executes the queries:

var interceptionContext = Context.GetInterceptionContext();
using (var reader = DbInterception.Dispatch.Command.Reader(command, new DbCommandInterceptionContext(interceptionContext)))
{
     foreach (var query in Queries)
     {
           query.SetResult(reader);
           reader.NextResult();
      }
}

I'm not sure what the interception context is exactly, but is there a way that I can make EF-Plus use the EFCache transaction interceptor and cache the individual queries?

Thanks, Sebastian

unable to see BulkSaveChanges

I am unable to see BulkSaveChanges in db context
Though i installed the package as well, but when i am using my existing dbcontext it wont show any extension method from the library

ORA-03113 with Devart and BulkInsert

Hi,

I'm getting an ORA-03113: end-of-file on communication channel exception when using BulkInsert. Do you have any ideas how to fix this error? I was assured by the DBA that the Oracle DB server is working properly, and that the problem seems to be in our app.

Stack trace: ORA-03113: end-of-file on communication channel
   at Devart.Data.Oracle.cq.a(Byte[] A_0, Int32 A_1, Int32 A_2)
   at Devart.Data.Oracle.cq.a(Byte& A_0)
   at Devart.Data.Oracle.ar.a(Byte[] A_0, Int32 A_1, Int32 A_2)
   at Devart.Data.Oracle.ar.g()
   at Devart.Data.Oracle.bm.a()
   at Devart.Data.Oracle.e.a(bm A_0, Int32 A_1)
   at Devart.Data.Oracle.e.a(Int32 A_0, s A_1)
   at Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
   at Devart.Data.Oracle.OracleCommand.ExecuteNonQuery()
   at Devart.Data.Oracle.OracleCommand.a(Int32 A_0, Boolean A_1, Int64[]& A_2)

ORA-03113: end-of-file on communication channel
ORA-03113: end-of-file on communication channel
   at Devart.Data.Oracle.OracleCommand.a(Int32 A_0, Boolean A_1, Int64[]& A_2)
   at Devart.Data.Oracle.OracleCommand.ExecuteArray(Int32 iters)

Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at ..(DbCommand , BulkOperation , Int32 )
   at ..(ExecuteAction , DbCommand )
   at Z.BulkOperations.DbActionExecutor.(List`1 )
   at Z.BulkOperations.OracleArrayProvider.(List`1 )
   at ..(BulkOperation )
   at Z.BulkOperations.BulkOperation.BulkInsert()
   at Z.EntityFramework.Extensions.EntityBulkOperation`1.BulkInsert()
   at Z.EntityFramework.Extensions.InternalBulkOperationManager.[](BulkOperation`1 , DbContext , List`1 , Boolean , List`1 , Type , String )
   at Z.EntityFramework.Extensions.InternalBulkOperationManager..(SchemaEntityType )
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Z.EntityFramework.Extensions.InternalBulkOperationManager.[](DbContext , BulkOperation`1 , IEnumerable`1 , List`1 )
   at Z.EntityFramework.Extensions.InternalBulkOperationManager.[](BulkOperation`1 , DbContext , IEnumerable`1 , List`1 )
   at DbContextExtensions.BulkInsert[T](DbContext this, IEnumerable`1 entities, Action`1 bulkOperationFactory)
   at DbContextExtensions.BulkInsert[T](DbContext this, IEnumerable`1 entities)

I've found a similar problem on devart's support forum (http://forums.devart.com/viewtopic.php?f=1&t=15912&hilit=03113) and they suggested that it was a timeout error.

The following describes how we use the BulkInsert method.
context.BulkInsert(collectionOfObjects);

I've also found a BatchTimeout setting in your library but I haven't found any docs stating, what the input value should be (ms, s, min?).

Any help would be greatly appreciated.
Regards, A

Exception : The wait operation timed out with BulkInsert

When inserting a list of 900.000 lines with BulkInsert we always get the exception : "The wait operation timed out with BulkInsert".
Even with setting a 6 hours timeout we continue get this exception, we even tried a huge 2 days timeout and the result is the same.

it does not save related objects

         var Retrivedmailinglist = db.MailingLists.Where(l => l.Name == listName).FirstOrDefault();
        var convertedMembers = members.Distinct().Select(m => new EmailMember { EmailAddress =         m.EmailAddress }).ToList();
        foreach (var emaliMember in convertedMembers)
            emaliMember.MailingLists.Add(Retrivedmailinglist);

        db.BulkInsert(convertedMembers);
        db.BulkSaveChanges();

How to use bulk insert

I use this kind of code to fill the context(I have multiple tables in it):
DictWord w = new DictWord { WordID = WordID_counter, Word = "word1", WordStat = 20 };
context.DictWords.Add(w);
context.SaveChanges();

Now I want to use bulk insert instead of this, but I don't understand how to do it. I thought I should do something like:
List<DictWord> dw = new List<DictWord>();
DictWord w = new DictWord { WordID = WordID_counter, Word = "word1", WordStat = 20 };
dw.Add(w);
context.DictWords.BulkInsert(dw);

Please correct me.

int primary key not identity BulkInsert problem

Table has a int primary key but no identity, when i call BulkInsert ,
Note: roles list every entity id has value.

List<Role> roles=new List<Role>();
roles.Add(new Role{Id=1,Name="admin"});
dbContext.BulkInsert(roles)

it will throw a exception like:
Cannot insert the value NULL into column 'id', table 'testdb.dbo.role'; column does not allow nulls. UPDATE fails

But if i change the primary key to identity=yes, BulkInsert is work fine.

Z.EntityFramework.Extensions with ASP.Net Core

I was Installed Z.EntityFramework.Extensions.EFCore -Pre

Install-Package Z.EntityFramework.Extensions.EFCore -Pre

bulkUpdate is fine but bulkInsert is not working

`

List lvs = new List();

        for (var i = 0; i < 100; i++)
        {
            VehicleStockLot vs = new VehicleStockLot();
            vs.lotNumber = i.ToString();
            vs.status = 1;
            vs.finishCount = 0;
            vs.totalCount = 100;
            vs.vehicleSupplierId = 8 + i;
            vs.vehicleSupplierId = 1;
            vs.addTime = DateTime.Now;
            lvs.Add(vs);
        }
        _ctx.BulkInsert(lvs);

`

The DestinationTableName cannot be null or empty. You must specify a valid DestinationTableName.

              var db = new TestContext();
                List<LoginLogEntity> users = new List<LoginLogEntity>(){new LoginLogEntity
                    {
                        Id = Guid.NewGuid(),
                        LoginType = 1,
                        LoginDevice = "IOS",
                        LoginIP = "",
                        LoginStatus = 1,
                        LoginPlace = "",
                        LoginTime = DateTime.Now,
                        OrgId = "971",
                        RealName = "JRT1",
                        UserId = userId,
                        UserType = 1
                    },
                     new LoginLogEntity
                    {
                        Id = Guid.NewGuid(),
                        LoginType = 1,
                        LoginDevice = "IOS",
                        LoginIP = "",
                        LoginStatus = 1,
                        LoginPlace = "",
                        LoginTime = DateTime.Now,
                        OrgId = "971",
                        RealName = "JRT1",
                        UserId = userId,
                        UserType = 1
                    }
               };
              db.BulkInsert(users);

Test code work's fine in my local server,but put it on Remote server, it always show me follow exception:

The DestinationTableName cannot be null or empty. You must specify a valid DestinationTableName.
at ..(BulkOperation )
at ..(BulkOperation )
at Z.EntityFramework.Extensions.EntityBulkOperation1.BulkInsert() at ..[](BulkOperation1 , DbContext , List1 , Boolean , List1 , Type , String )
at ...(SchemaEntityType )
at System.Collections.Generic.List1.ForEach(Action1 action)
at ..[](DbContext , BulkOperation1 , IEnumerable1 , List1) at ..[](BulkOperation1 , DbContext , IEnumerable1 , List1)
at DbContextExtensions.BulkInsert[T](DbContext this, IEnumerable1 entities, Action1 bulkOperationFactory)
at DbContextExtensions.BulkInsert[T](DbContext this, IEnumerable`1 entities)

Column 'ZZZ_Index' does not belong to table

Tried to do a simple bulk insert via BulkSaveChangesor BulkInsert, I get the following exception:

Column 'ZZZ_Index' does not belong to table 
   at System.Data.DataRow.GetDataColumn(String columnName)
   at System.Data.DataRow.get_Item(String columnName)
   at �.�.�(� , DataTable )
   at �.�.�(� , DataTable )
   at �.�.�(� , DbCommand )
   at �.�.�(List`1 )
   at �.�.�(List`1 )
   at �.�.�(BulkOperation )
   at Z.BulkOperations.BulkOperation.BulkInsert()
   at Z.EntityFramework.Extensions.EntityBulkOperation`1.BulkInsert()
   at �.�.�[�](BulkOperation`1 �, DbContext �, List`1 �, Boolean �, List`1 �, Type �, String �)
   at �.�.�.�(SchemaEntityType )
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at �.�.�[�](DbContext �, BulkOperation`1 �, IEnumerable`1 �, List`1 �)
   at �.�.�[�](BulkOperation`1 �, DbContext �, IEnumerable`1 �, List`1 �)
   at DbContextExtensions.BulkInsert[T](DbContext this, IEnumerable`1 entities, Action`1 bulkOperationFactory)
   at DbContextExtensions.BulkInsert[T](DbContext this, IEnumerable`1 entities)

Constructors with optional parameters...

Just experimenting with this, and I imported the "MomentSharp" NuGet package to experiment with date manipulation.
Any call to new Moment() raises the exception

Value cannot be null.
Parameter name: constructor

The signature is simply
public Moment(bool zero = false)
Providing false avoids the problem.

Are optional parameters not implemented, or am I missing something?

Thanks, Jason

Bulk Delete vs Batch Delete?

Hi,

Is there a difference between the two deletes with EF Extensions vs EF Plus?

EF Extensions:

context.Customers
    .Where(x => x.LastLogin < DateTime.Now.AddYears(-2))
    .DeleteFromQuery(operation => operation.BatchSize = 10000);

EF Plus:

ctx.Users.Where(x => x.LastLoginDate < DateTime.Now.AddYears(-2))
         .Delete(x => x.BatchSize = 1000);

I'm curious if there is an added benefit to one versus the other where I might want to also reference EF+ or if they're effectively duplicated functionality where I should only use EF Extensions?

Cannot work correctly with DB Transaction?

Hi,

I am testing your v3.10.58 version. It's strange when using BulkInsert or BulkMerge in an Unit Work or Transaction with Oracle DB.

For Example, I am using aspnetboilerplate framework, BulkInsert seems only work when Disable Unit of Work and BulkMerge seems work in own transaction (no rollback even throw exception before completing Unit of Work).

using (var uow = _uow.Begin()) //TransactionScope Unit of Work
{
this.Context.BulkInsert(customers); // it's not work when in a TransactionScope
this.Context.BulkMerge(customers); // its work but seems use own transaction and cannot rollback
this.Context.BulkSaveChanges();
uow.Complete();
}

I'm not sure if it's ABP framework issue, kindly can you give me some advise ?

this is ABP unit of work document

Cancellable async operations

It would be nice to have DbContextExtensions overloads that accept CancellationToken parameter :

public static class DbContextExtensions
{
    public static Task BulkDeleteAsync<T>(this DbContext @this, IEnumerable<T> entities) where T : class;
    public static Task BulkDeleteAsync<T>(this DbContext @this, IEnumerable<T> entities, Action<EntityBulkOperation<T>> bulkOperationFactory) where T : class;
....
}

Please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.