Skip to content

Releases: zzzprojects/EntityFramework-Extensions

v3.13.16

27 Nov 03:15
6ec5186

Choose a tag to compare

Download the library here

PATCH

  • FIXED: InvalidOperationException on BulkMerge with IncludeGraph = true #62
  • FIXED: UpdateFromQuery + Oracle + Bool type

PRO Version unlocked for the current month (November)

v3.13.13

20 Nov 04:08
daeef45

Choose a tag to compare

Download the library here

PATCH

  • FIXED: UpdateFromQuery issue with enum type + Oracle.ManagedDataAccess

PRO Version unlocked for the current month (November)

v3.13.12

09 Nov 02:39
daeef45

Choose a tag to compare

Download the library here

PATCH

  • ADDED: Support to BulkDelete + IncludeGraph (Require UnsafeMode = true`)
  • ADDED: Support to BulkSynchronize + IncludeGraph (Require UnsafeMode = true`)

Both methods require unsafe mode turned once as they are DELETE operation. Additionally, some issue could occur with BulkSynchronize if relations between entity are too deep.

PRO Version unlocked for the current month (November)

v3.13.11

07 Nov 01:50

Choose a tag to compare

Download the library here

PATCH

  • FIXED: Custom SubsetKey when key is not part of other expressions such as Input or Key

PRO Version unlocked for the current month (November)

v3.13.9

30 Oct 21:05
4d0e5f4

Choose a tag to compare

Download the library here

PATCH

  • ADDED: Some debug information for issue #61
  • FIXED: Support ForceSelectOutput + UDF Calculated Column + Custom SubsetKey

PRO Version unlocked for the current month (November)

v3.13.8

26 Oct 17:20

Choose a tag to compare

Download the library here

PATCH

  • ADDED: Error attempting BulkInsert with SQLite on Model with manually specified Key value #60
  • FIXED: Support ForceSelectOutput + UDF Calculated Column + Custom Key

PRO Version unlocked for the current month (October)

v3.13.7

26 Oct 02:16

Choose a tag to compare

Download the library here

PATCH

  • FIXED: AutoTruncate has begun to fail recently #58
  • ADDED: Support ForceSelectOutput + UDF Calculated Column

PRO Version unlocked for the current month (October)

v3.13.6

22 Oct 20:42

Choose a tag to compare

Download the library here

PATCH

  • ADDED: MergeMatchedAndFormula option
ctx.BulkMerge(list, options =>
{
    options.MergeMatchedAndFormula = "[DestinationTable].[ColumnInt] > [StagingTable].[ColumnInt]";
});

PRO Version unlocked for the current month (October)

v3.13.5

16 Oct 16:11

Choose a tag to compare

Download the library here

PATCH

  • ADDED: `IsReadOnly option (Only retrieve output value without performing save operation)

This option can be useful to retrieve identity value when using a custom key.

Example:

using System.Collections.Generic;
using System.Data.Entity;
using System.Windows.Forms;
using Z.BulkOperations;

namespace Z.EntityFramework.Extensions.Lab
{
    public partial class Form_Request_Scenario_UserRole : Form
    {
        public Form_Request_Scenario_UserRole()
        {
            InitializeComponent();

            // CLEAR
            using (var ctx = new CurrentContext())
            {
                ctx.Users.RemoveRange(ctx.Users);
                ctx.Roles.RemoveRange(ctx.Roles);
                ctx.BulkSaveChanges();
            }

            // SEED
            using (var ctx = new CurrentContext())
            {
                var user1 = ctx.Users.Add(new User {Name = "User_1"});
                var user2 = ctx.Users.Add(new User {Name = "User_2"});

                var role1 = ctx.Roles.Add(new Role {Name = "Role_1"});
                var role2 = ctx.Roles.Add(new Role {Name = "Role_2"});

                // Only the user1 have a role
                user1.Roles = new List<Role>();
                user1.Roles.Add(role1);

                ctx.SaveChanges();
            }

            // If your project has multiple contexts, you can use the "context" variable to know which
            // context type to create or get options from it.
            EntityFrameworkManager.ContextFactory = context => new CurrentContext();

            // TEST
            using (var ctx = new CurrentContext())
            {
                // Importation from a list

                // Create instance of existing user and create a new user
                var user1 = new User {Name = "User_1"};
                var user2 = new User {Name = "User_2"};
                var user3 = new User {Name = "User_3"};
                var users = new List<User> {user1, user2, user3};

                // Create instance of existing role
                var role1 = new Role {Name = "Role_1"};
                var role2 = new Role {Name = "Role_2"};

                user2.Roles = new List<Role> { role2 };
                user3.Roles = new List<Role> { role1, role2 };

                ctx.BulkMerge(users, options =>
                {
                    options.IncludeGraph = true;
                    options.IncludeGraphOperationBuilder = operation =>
                    {
                        if (operation is BulkOperation<User>)
                        {
                            var bulk = (BulkOperation<User>)operation;
                            bulk.ColumnPrimaryKeyExpression = x => x.Name;
                        }
                        else if (operation is BulkOperation<Role>)
                        {
                            var bulk = (BulkOperation<Role>)operation;
                            bulk.IsReadOnly = true;
                            bulk.ColumnPrimaryKeyExpression = x => x.Name;
                        }
                    };
                });
            }
        }

        public class CurrentContext : DbContext
        {
            public CurrentContext()
                : base("CodeFirstEntities")
            {
            }

            public DbSet<User> Users { get; set; }
            public DbSet<Role> Roles { get; set; }

            protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {
                modelBuilder.Types().Configure(x => x.ToTable(GetType().DeclaringType != null ? GetType().DeclaringType.FullName.Replace(".", "_") + "_" + x.ClrType.Name : ""));

                base.OnModelCreating(modelBuilder);
            }
        }

        public class User
        {
            public int ID { get; set; }

            public string Name { get; set; }

            public List<Role> Roles { get; set; }
        }

        public class Role
        {
            public int ID { get; set; }

            public string Name { get; set; }

            public List<User> Users { get; set; }
        }
    }
}

PRO Version unlocked for the current month (October)

v3.13.4

13 Oct 16:30

Choose a tag to compare

Download the library here

PATCH

  • FIXED: IncludeGraph with Many to Many Scenario

PRO Version unlocked for the current month (October)