mardi 2 février 2016

Entity framework 5 easy mapping from Oracle to SQlite dbfirst

My application is mapped with an Oracle database and the data model was created based on database model (dbfirst).

We're now facing the problem of unit testing. As you expect, we have to interact with database to validate our processes. We don't want to mock the data and retrieve it from a data source.

We have two options :

  • Create a schema dedicated for our unit testing in Oracle,
  • Set out unit testing data in a sqlite and connect our data layer to sqlite instead of Oracle.

We'd rather follow the second option for the simplicity of use (create your core data, duplicate it for testing, throw it out and restart from core data at each test, avoiding data alteration implied from unit testing).

However, I'm a bit skeptical about the ease of use whenever it comes to map from Oracle to Entity, especially with a DBFirst model for multiple reasons :

  • When editing edmx file, provider is hard written (Oracle.ManagedDataAccess)
  • Plus, aren't types in edmx files depending on the database representation ? (ie nvarchar2)
  • I don't think so but, do we have to write different edmx for multiple databases ?

If it implies too much rework, we'll go on the first solution but I think I'm missing something on EF mechanics because it shouldn't be too hard.

Thank you

Aucun commentaire:

Enregistrer un commentaire