Type converter for System.Object in MsAccess

Posts   
 
    
Valemus avatar
Valemus
User
Posts: 37
Joined: 09-Jan-2018
# Posted on: 22-Feb-2018 11:37:38   

Hi,

I have a project (model-first) sync with a Sql Server Relational Model Data.

I'm trying to add a MsAccess Relational Model Data, because I'd need to switch between these two DB (another question will follow on a separate thread about that).

However, when I try to sync the Model to MsAccess, I get errors converting the fields of type System.Object. I've seen that there's not a built-in converter for this (why not?)

So, how can I create a new converter? I've seen the Documentation ( https://www.llblgen.com/documentation/5.3/Designer/Functionality%20Reference/ProjectSettings.htm#conventions-entity-model-type-shortcuts ) , I got the idea on how the things are working but I didn't solve my problem.

Thanks!

Valemus avatar
Valemus
User
Posts: 37
Joined: 09-Jan-2018
# Posted on: 22-Feb-2018 11:41:00   

If it can be useful, the error received during Sync is:

Field creation of field 'ElementData' in table 'Default.Default.Element' failed: no compatible DB type found for type 'System.Object'.

Valemus avatar
Valemus
User
Posts: 37
Joined: 09-Jan-2018
# Posted on: 22-Feb-2018 12:40:26   

And just for adding more fish to fry... I've the same problem converting System.Guid to MySql.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Feb-2018 15:23:06   

For MS Access System.Object isn't mapped to a type, as it's not an object that's usable in the .NET space (as it's an ms access binary blob). therefore it's not usable in any way so we don't map it to a type.

You can change that with a type converter if you want, however to what .NET type you should convert these is not clear, as what values do these fields represent? To implement a type converter, see the SDK: https://www.llblgen.com/Documentation/5.3/SDK/gui_implementingtypeconverter.htm

For guid in mysql: it's not a type supported by mysql. So you have to store the guid differently. Our framework supports 2 representations, which are backed by system (built-in) type converters: Guid <-> string or Guid <-> byte[] (32 bytes).

To use these, define a type conversion in the project settings (Entity Model -> Type conversions, then specify the relational model type (e.g. byte[] or string) and pick the right type converter. Optionally define a filter in the dialog for datatype.

Frans Bouma | Lead developer LLBLGen Pro
Valemus avatar
Valemus
User
Posts: 37
Joined: 09-Jan-2018
# Posted on: 22-Feb-2018 15:31:03   

Otis wrote:

You can change that with a type converter if you want, however to what .NET type you should convert these is not clear, as what values do these fields represent? To implement a type converter, see the SDK: https://www.llblgen.com/Documentation/5.3/SDK/gui_implementingtypeconverter.htm

I don't know either... using the System.Object field is very useful in some situations, but if this locks down the possibility to switch to the Access model, I'll have to drop it disappointed

Otis wrote:

For guid in mysql: it's not a type supported by mysql. So you have to store the guid differently. Our framework supports 2 representations, which are backed by system (built-in) type converters: Guid <-> string or Guid <-> byte[] (32 bytes).

That's great! Thank you!