zzzprojects / EntityFramework-Effort

Entity Framework Effort is a powerful tool that enables a convenient way to create automated tests for Entity Framework based applications.
https://entityframework-effort.net/
MIT License
431 stars 99 forks source link

Add Oracle number #179

Closed kubabuda closed 5 years ago

kubabuda commented 5 years ago

Added Number type used by Oracle, to fix exception

{"The store type 'NUMBER' could not be found in the Effort provider manifest"}

JonathanMagnan commented 5 years ago

Hello @kubabuda ,

I believe this pull will add some error.

The Oracle number can also be a decimal?

If you wish, you can use your own custom provider manifest EntityFrameworkEffortManager.CustomManifestPath, but unless you prove me wrong, I don't think we can merge this pull request.

Best Regards,

Jonathan


Performance Libraries context.BulkInsert(list, options => options.BatchSize = 1000); Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus

Runtime Evaluation Eval.Execute("x + y", new {x = 1, y = 2}); // return 3 C# Eval FunctionSQL Eval Function

kubabuda commented 5 years ago

Hello,

Damn, you're right. I tested this change on my project using CustomManifestPath, but my entities used no decimal - only int properties. It was too obvious to be just omited without reason, could have seen it from Oracle docs.

That means if you want to use Effort and Oracle, you can have either int or decimal properties, but no both?

Regards, Kuba

JonathanMagnan commented 5 years ago

I have attached the provider manifest found on their dll: Oracle_ProviderManifest.txt

The number seem to be always mapped to decimal

<Type Name="number" PrimitiveTypeKind="Decimal">
  <FacetDescriptions>
    <Precision Minimum="1" Maximum="38" Constant="false" DefaultValue="38" />
    <Scale Minimum="0" Maximum="38" Constant="false" DefaultValue="0" />
  </FacetDescriptions>
</Type>

Could you try it? It might maybe lead to some other errors, however.

kubabuda commented 5 years ago

I tried it and it worked fine. Looking at generated migrations, EF uses decimal in generated migrations

public override void Up()
{
    CreateTable(
    "TABLE_NAME",
    c => new
        {
            ID = c.Decimal(nullable: false, precision: 10, scale: 0, identity: true),

for entities with int properties:

public MyEntity()
{
    ToTable("TABLE_NAME");
    Property(p => p.Id)
        .HasColumnName("ID").HasColumnType("NUMBER")
        .IsRequired();

Overall looks like mapping number on decimal works for int, is in line with how Entity works on Oracle - overall looks like better way than my proposition.

Will you merge it, to have default config working for most user cases on Oracle out of the box? Or will you create "Oracle" section somewhere in config and copy this snippet there?

JonathanMagnan commented 5 years ago

Awesome,

Could you update your pull with the fix in this case? So I will merge it and release a new version. I believe only oracle use number type name, so I guess we can include it in the default provider manifest but we will eventually need one that's specific for Oracle.

kubabuda commented 5 years ago

Happily done. I agree, AFAIK it is safe... And in case of problems meaningful error messages and marked Oracle section of default manifest are making preparing custom one easy. Is the next release date already known?

JonathanMagnan commented 5 years ago

Next released is now ;)

The v2.2.3 is now available.

Let me know if that work as expected with your merge

kubabuda commented 5 years ago

Updated to 2.2.3, removed custom manifest, tests are passing on laptop and CI server - can't get any better :)