thank you - reset button updated a mapping list and it seems quite different from what I had.
problem fixed.
Search found 7 matches
- Sat 19 Feb 2022 17:04
- Forum: Entity Developer
- Topic: Entity Developer 6.12.1419 EF Core wrong field type for MySql
- Replies: 5
- Views: 10899
- Thu 17 Feb 2022 18:32
- Forum: Entity Developer
- Topic: Entity Developer 6.12.1419 EF Core wrong field type for MySql
- Replies: 5
- Views: 10899
Re: Entity Developer 6.12.1419 EF Core wrong field type for MySql
I am using dotConnect for MySQL v.8.21.2066 (just reinstalled to make sure it is latest one)
never actually checked the default mapping before so not quite sure if it correct or not (screenshot has most of numeric related types):
is there mapping settings file anywhere to check if it was modified or damaged?
after I added manually mapping int->int32
it started working again. but definitely was never messing with mapping options before. is there any way to compare my mapping setup to default?
never actually checked the default mapping before so not quite sure if it correct or not (screenshot has most of numeric related types):
is there mapping settings file anywhere to check if it was modified or damaged?
after I added manually mapping int->int32
it started working again. but definitely was never messing with mapping options before. is there any way to compare my mapping setup to default?
- Wed 16 Feb 2022 20:04
- Forum: Entity Developer
- Topic: Entity Developer 6.12.1419 EF Core wrong field type for MySql
- Replies: 5
- Views: 10899
Entity Developer 6.12.1419 EF Core wrong field type for MySql
Hello I started to have issue with Entity Developer 6.12.1419. For some reason it assign "string" type for some of the fields when I adding table to the diagram view from the database explorer.
I noticed that it is mostly happen to INT fields. Timestamp working ok (converted to DateTime).
for this example I used Database first, empty model. EF Core 6 / .Net 6 with all default settings.
Entity Developer Diagram view:
PhpMyAdmin table structure view:
I noticed that it is mostly happen to INT fields. Timestamp working ok (converted to DateTime).
for this example I used Database first, empty model. EF Core 6 / .Net 6 with all default settings.
Entity Developer Diagram view:
PhpMyAdmin table structure view:
- Wed 14 Apr 2021 18:10
- Forum: Entity Developer
- Topic: MySQL Timestamp default precision mapping issue
- Replies: 6
- Views: 3087
Re: MySQL Timestamp default precision mapping issue
was able to fix my case using code below (example only for timestamp type):
still thinking it is quite important feature for mysql version of Entity Developer. Would be great to have an option for entity developer to generate (or not) default precision value for specific types (datetime/time/timestamp)
Code: Select all
partial void CustomizeMapping(ref ModelBuilder modelBuilder)
{
var _modelBuilder = modelBuilder;
_modelBuilder.Model.GetEntityTypes().ToList().ForEach(e => {
e.GetProperties().Where(p=>p.GetColumnType()=="timestamp" && p.GetPrecision()==null).ToList().ForEach(p =>
{
_modelBuilder.Entity(e.ClrType).Property(p.Name).HasPrecision(0);
});
});
}
- Wed 07 Apr 2021 14:43
- Forum: Entity Developer
- Topic: MySQL Timestamp default precision mapping issue
- Replies: 6
- Views: 3087
Re: MySQL Timestamp default precision mapping issue
I am not good at this area but as far as I understand, use of this option will basicaly disable ef.core concurrency control feature as it depend on the real affected number.
Also if entity developer respect the TIMESTAMP(X) precision, why not respect the default precision value also? Am I missing something cruical here? is it considered as bad behaviour?
Also if entity developer respect the TIMESTAMP(X) precision, why not respect the default precision value also? Am I missing something cruical here? is it considered as bad behaviour?
- Tue 06 Apr 2021 16:56
- Forum: Entity Developer
- Topic: MySQL Timestamp default precision mapping issue
- Replies: 6
- Views: 3087
Re: MySQL Timestamp default precision mapping issue
thank you for the answer,
but this option seems more like workaround in this specific case and not real solultion for the TIMESTAMP precision issue.
Correct me if I am wrong.
I can track such fields on my own and cut fraction part for the seconds but this defeat purpose of using entity framework with integrated checks etc. Also I don't know if I can set .HasPrecision(0) for the default timestamp fields without it to be overwritten on the next model's code generation.
but this option seems more like workaround in this specific case and not real solultion for the TIMESTAMP precision issue.
Correct me if I am wrong.
I can track such fields on my own and cut fraction part for the seconds but this defeat purpose of using entity framework with integrated checks etc. Also I don't know if I can set .HasPrecision(0) for the default timestamp fields without it to be overwritten on the next model's code generation.
- Thu 01 Apr 2021 20:11
- Forum: Entity Developer
- Topic: MySQL Timestamp default precision mapping issue
- Replies: 6
- Views: 3087
MySQL Timestamp default precision mapping issue
Hello,
was not able to found a settings or any other way to fix this by myself, so asking for help:
I have TIMESTAMP field in the mysql db with default precision (which is 0 according to mysql docs).
When code is generated from model it has no ".HasPrecision(0)" call for this db field in the mapping method. This seems to cause error:
expecting 1 affected record.
The TIMESTAMP(X) fields has no such issue because ".HasPrecision(X)" is generated.
was not able to found a settings or any other way to fix this by myself, so asking for help:
I have TIMESTAMP field in the mysql db with default precision (which is 0 according to mysql docs).
When code is generated from model it has no ".HasPrecision(0)" call for this db field in the mapping method. This seems to cause error:
Error raised when there at least 2 calls of dbContext.SaveChanges() during ONE second when there only TIMESTAMP field is changed. As I understand, MySql does not update the db because timestamp value did not change, but ef.core is"Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s)"
expecting 1 affected record.
The TIMESTAMP(X) fields has no such issue because ".HasPrecision(X)" is generated.