SQL Compact (CE) 4.0 support

Posts   
 
    
khorvat avatar
khorvat
User
Posts: 65
Joined: 17-Feb-2011
# Posted on: 17-Feb-2011 14:59:51   

Hi,

does LLBLGen 3.1 supports the SQL CE 4.0 ?

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Feb-2011 15:05:41   

Same as 3.5, it uses the 3.5 syntax for it. 4.0 specific features are currently not supported yet, so you can't create a project from it, nor can it do 'server' side paging. We have planned to support 4.0 specific features in a future version.

So set the DQE compatibility (if you're using our framework) to CE35.

Frans Bouma | Lead developer LLBLGen Pro
khorvat avatar
khorvat
User
Posts: 65
Joined: 17-Feb-2011
# Posted on: 18-Feb-2011 13:56:18   

I have tried to connect to SQL4.0 with LLBLGen 3.1 and I have set the DQE to CE35 and I get the following error:

Incompatible Database Version. If this was a compatible file, run repair. For other cases refer to documentation. [ Db version = 4000000,Requested version = 3505053,File name = \?\C:\Projects\TBCME\xFiles\LangTest\Database\tbme.sdf ]


   at System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr)
   at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent)
   at System.Data.SqlServerCe.SqlCeConnection.Open()
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.OpenConnection() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 1089
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.PrepareQueryExecution(IQuery queryToExecute, Boolean forceConnectionSet) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 5651
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteMultiRowRetrievalQuery(IRetrievalQuery queryToExecute, IEntityFactory2 entityFactory, IEntityCollection2 collectionToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo, Boolean allowDuplicates, IEntityFields2 fieldsUsedForQuery) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 601
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollectionInternal(IEntityCollection2 collectionToFill, IRelationPredicateBucket& filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 4581
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IPrefetchPath2 prefetchPath, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 2465
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterBase.cs:line 2275
   at LangTest.Form1.button2_Click(Object sender, EventArgs e) in C:\Projects\TBCME\xFiles\LangTest\LangTest\LangTest\Form1.cs:line 72
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at LangTest.Program.Main() in C:\Projects\TBCME\xFiles\LangTest\LangTest\LangTest\Program.cs:line 18
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

And this is my sample code:



DataAccessAdapter.SetSqlServerCompatibilityLevel(SqlServerCompatibilityLevel.SqlServerCE35);                
EntityCollection<TestLangEntity> collection = new EntityCollection<TestLangEntity>();
using (IDataAccessAdapter adapter = new Repository().GetAdapter(connectionString))
{
  adapter.FetchEntityCollection(collection, null);
}

public class Repository 
    {
        

        public SD.LLBLGen.Pro.ORMSupportClasses.IDataAccessAdapter GetAdapter(string connString)
        {
            return new DataAccessAdapter(connString, false, SD.LLBLGen.Pro.ORMSupportClasses.CatalogNameUsage.Clear, null);
        }
    }


Also note that I have included all assembly references to the SQLCE40 to my sample project, I have build the project on SQL Express 2008 server then transfer the schema to the SQLCE35 and SQLCE40. I can connect to SQLCE35 without any problems but I can't connect to 4.0.

I'm I missing something ?

Regards

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Feb-2011 17:45:58   

Hmm. This might be due to factory creation issues. (it creates a CE35 dbproviderfactory, which is likely the cause).

We thought we could get away with it with the 3.5 code, but alas, it's not. We'll see what we can do on monday to make the DQE instantiate a ce40 dbproviderfactory.

Frans Bouma | Lead developer LLBLGen Pro
khorvat avatar
khorvat
User
Posts: 65
Joined: 17-Feb-2011
# Posted on: 18-Feb-2011 18:33:50   

Ok, thanks ... let me know when you have something for us.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-Feb-2011 12:30:21   

As the tooling / sample db's aren't released yet (they're in VS.NET 2010 SP1), we can't test it. So we added it in the dark, i.o.w.: it might fail. Please see whether the attached dlls will work for you. (What we did was add 4.0 support for the factory and for SQL generation similar to 3.5)

As we couldn't test it, we couldn't add the paging query support which SEEMS to be there, although the BoL for CE4.0 doesn't spend a word on it (read: the CTP had it, but I doubt it is in the final CE4.0 syntax, but as we can't test it we can't try it)

All in all, not really a great system at the moment, but I guess it's because of the lack of VS.NET 2010 SP1 availability.

You need both dlls together in your application. Setting the compatibility at the config file level requires you to use the value '5'

Frans Bouma | Lead developer LLBLGen Pro
khorvat avatar
khorvat
User
Posts: 65
Joined: 17-Feb-2011
# Posted on: 21-Feb-2011 13:13:00   

Ok, thanks I'll give it a try and let you know.

khorvat avatar
khorvat
User
Posts: 65
Joined: 17-Feb-2011
# Posted on: 08-Apr-2011 09:35:25   

Hi,

sorry for the delay, project was on hold etc. We have tested the patch you have provide us with and it works fine. We can connect to SQL CE 4.0 and so far we didn't stumble on any problems.

Thanks again

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Apr-2011 10:40:53   

Good to hear it worked out fine simple_smile

Frans Bouma | Lead developer LLBLGen Pro