Giter VIP home page Giter VIP logo

Comments (14)

JonathanMagnan avatar JonathanMagnan commented on May 18, 2024 3

Hello @007gzs , @serifreedom ,

The v3.12.16 has been released.
https://www.nuget.org/packages/Z.EntityFramework.Extensions/

We added the support to column type uint. As Entity Framework do, we bind it to type long

Let me know if the new version has fixed this issue on your side.

Best Regards,

Jonathan

from entityframework-extensions.

JonathanMagnan avatar JonathanMagnan commented on May 18, 2024 1

Hello @007gzs ,

For my knowledge, Entity Framework doesn't support LazyType at all?

By example, using the following code, Entity Framework will skip the LazyColumnInt property

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

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

            // CLEAN
            using (var ctx = new CurrentContext())
            {
                ctx.Parents.RemoveRange(ctx.Parents);
                ctx.SaveChanges();
            }

            // SEED

            // TEST
            using (var ctx = new CurrentContext())
            {
                var list = new List<Parent>();
                for (var i = 0; i < 10; i++)
                {
                    var i2 = i;
                    list.Add(new Parent { ID = 1 + i * 3, ColumnInt = i, LazyColumnInt = new Lazy<int>(() => i2)});
                }

                ctx.Parents.AddRange(list);
                ctx.SaveChanges();
            }
        }

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

            public DbSet<Parent> Parents { 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 Parent
        {
            public int ID { get; set; }
            public int ColumnInt { get; set; }
            public Lazy<int> LazyColumnInt { get; set; }
        }
    }
}

Do you think you could provide us a working example using SaveChanges to let us investigate this issue?

Best Regards,

Jonathan

from entityframework-extensions.

serifreedom avatar serifreedom commented on May 18, 2024 1

zzz

It's not problem in method SaveChanges(Tested work fine) , which is default DbContext method.
It's error in "BulkInsert" extension method while using EntityFramework + your EntityFramework-Extensions + MySql, Database First Models on Table

CREATE TABLE sales (
entity_id int(11) NOT NULL AUTO_INCREMENT,
type varchar(32) DEFAULT NULL,
account varchar(32) CHARACTER SET latin1 DEFAULT NULL,
pay_date date DEFAULT NULL,
merch_number varchar(32) DEFAULT NULL,
order_sl varchar(50) DEFAULT NULL,
trans_code varchar(32) DEFAULT NULL,
trans_date date DEFAULT NULL,
amount decimal(12,2) DEFAULT NULL,
store_name varchar(255) DEFAULT NULL,
shot_code varchar(32) DEFAULT NULL,
gold_code varchar(24) DEFAULT NULL,
batch_export varchar(24) DEFAULT NULL,
PRIMARY KEY (entity_id),
UNIQUE KEY entity_id_UNIQUE (entity_id),
KEY IDX_SALES_ORDER_SL (order_sl)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8

I guess the error because it's miss match datatype entity_id int(11) between EF-Ex and MySql

Please Help ASAP!.

from entityframework-extensions.

JonathanMagnan avatar JonathanMagnan commented on May 18, 2024 1

Hello @serifreedom ,

Thank you, we misread this issue the first time.

We will investigate this issue today and probably release a fix this night.

Best Regards,

Jonathan

from entityframework-extensions.

serifreedom avatar serifreedom commented on May 18, 2024 1

@JonathanMagnan , Unfortunately, It's still error! but with another type! or did i do anything wrong?

CREATE TABLE `sales_interface_order_tmp3` (
  `entity_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(32) DEFAULT NULL,
  `bank_account` varchar(32) CHARACTER SET latin1 DEFAULT NULL,
  `mer_number` varchar(32) DEFAULT NULL,
  `order_sl` varchar(50) DEFAULT NULL,
  `trans_code` varchar(32) DEFAULT NULL,
  `store_name` varchar(255) DEFAULT NULL,
  `shot_code` varchar(32) DEFAULT NULL,
  `gold_code` varchar(24) DEFAULT NULL,
  `batch` varchar(24) DEFAULT NULL,
  PRIMARY KEY (`entity_id`),
  KEY `IDX_SALES_INTERFACE_ORDER_TMP3_ORDER_SL` (`shopee_order_sl`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8

zzz2

Thank you.

from entityframework-extensions.

JonathanMagnan avatar JonathanMagnan commented on May 18, 2024 1

Hello @serifreedom ,

Thank you, we made sure this time all unsigned type is supported!

The v3.12.16 has been released.
https://www.nuget.org/packages/Z.EntityFramework.Extensions/

Let me know if all type issue is fixed.

Best Regards,

Jonathan

from entityframework-extensions.

serifreedom avatar serifreedom commented on May 18, 2024 1

@JonathanMagnan ,Thank you for quick release. But!
Again...,What is this error? not data type mapping anymore,Now I guess EF-Ex confusing connection between MS SQL and MySQL, I'm using both Db server in the same project with separate connections/DbContext/Models.

zzz3

Any Idea?

from entityframework-extensions.

JonathanMagnan avatar JonathanMagnan commented on May 18, 2024

Hello @serifreedom ,

I just tried in a project (MySQL + SQL Server) and it works fine on my side.

Do you believe you could create a project that has this error and send it to us ([email protected])? Or give us a hint to reproduce it.

Best Regards,

Jonathan

from entityframework-extensions.

serifreedom avatar serifreedom commented on May 18, 2024

Hello @JonathanMagnan,
I will try create project for you to reproduce error later, What's different between default SaveChanges and BulkInsert? SaveChanges always complete!, It's the same Dbcontext/Connection. Is EF-Ex require any special/full permission to Db?
FYI,exception thrown access denied for 'user@[my LAN ip]' instead of [server ip] from connection string!?

from entityframework-extensions.

JonathanMagnan avatar JonathanMagnan commented on May 18, 2024

Hello @serifreedom ,

I'm not sure yet was is causing this issue since we cannot reproduce it. I believe it may be caused by something we cache in the library and the unique key (with the context added) is the same for both context.

I believe it will be very easy to find once we receive the project.

Best Regards,

Jonathan

from entityframework-extensions.

JonathanMagnan avatar JonathanMagnan commented on May 18, 2024

Hello @serifreedom ,

Did you succeed to create the project?

Best Regards,

Jonathan

from entityframework-extensions.

serifreedom avatar serifreedom commented on May 18, 2024

Hello @JonathanMagnan,
Found the problem, No need sample project. Like I have asked you before, EF-Ex required ALL PRIVILEGES permission on Database for LOCK TABLES, if use BulkInsert :

LOCK TABLES TableA WRITE, TableA AS DestinationTable READ;

But BulkSaveChanges no need to LOCK TABLES. Wondering why...

I think this issue might be solved.

from entityframework-extensions.

JonathanMagnan avatar JonathanMagnan commented on May 18, 2024

Hello @serifreedom ,

I have looked at it today. BulkSaveChanges also require LOCK TABLES on insert if the table has an identity value.

Best Regards,

Jonathan

from entityframework-extensions.

JonathanMagnan avatar JonathanMagnan commented on May 18, 2024

Hello @serifreedom ,

Feel free to reopen if you have more question.

Best Regards,

Jonathan

from entityframework-extensions.

Related Issues (20)

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.