Problems with ORM

Aug 25, 2012 at 11:27 AM

Hi all,

I am having problems using the ORM Framework. My setup is:

Windows 7 64 bit profesional

Visual Studio 2008 sp2

Mobile SDK 6

The error I get is:

File or assembly name 'System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=3BE235DF1C8D2AD3', or one of its dependencies, was not found.

I have added a reference to it and to the OpenNETCF.ORM.

When I try it on an old XP machine (32bit) it works ok, so it must be Windows 7 or the fact that it is 64bit.

Any ideas on how to get it to work on my machine?

Thanks in advance,

Steve.

 

 

Coordinator
Aug 25, 2012 at 3:19 PM

It sounds like maybe you don't have SQL CE 3.5 SP3 installed on the target devce (and maybe not on your PC?).  You could always use the ORM project as a referene, instead of a binary, and it would then bind to the version on your build machine.

Aug 26, 2012 at 2:38 PM

Thanks Chris, hadn't thought about referencing the project! Works fine now. Another problem, when I create the store and try and add a type to it, nothing happens!!

Here is the class:

[Entity]
internal class Test
{
[Field(IsPrimaryKey = true)]
public int ID { get; set; }
[Field]
public byte[] Data { get; set; }
}

And the code:

var store = new SqlCeDataStore("Test.sdf");
if (!store.StoreExists)
{
store.CreateStore();
}
store.AddType(typeof(Test));

Any ideas?

Many thanks,

Steve.

 

 

Coordinator
Aug 26, 2012 at 4:59 PM

Either add the type before CreateStore, or call "EnsureCompatibility" after adding the type.  I'll likely update the behavior to create the table on AddType next week (I hit the same problem with dynamic entities).

 

Aug 27, 2012 at 10:22 AM

Thanks Chris for the prompt and speedy replies! All working fine now. Looking forward to junking a load of sql code shortly!

A very appreciative Steve.