[Mono-dev] SqlCeServer on mono
Manuel de la Pena
etil15 at gmail.com
Wed May 16 09:40:09 EDT 2007
Yes, you are completely right when saying that a workaround can be
easily done using the already implemented tools... It shouldn't be a
hard think to do a conditional compilation of the code where
according to the platform the code would use one technology or other
one...
The problem is that for some reason the people a Microsoft decided to
use a completely new namespace for SqlCe server. That is, they have
implemented a SqlCeDataReader, SqlCeCommand etc...
My question is the following.. If someone has already created an
application using the Visual studio tools and have made some code
such as
public void Method(){
SqlCeConnection conn = new SqlCeConnection(connectionString);
SdlCeCommand sql = new SqlCeCommand("SELECT * FROM table", conn);
SqlCeDataReader dataReader = sql.ExecuteReader();
while(dataReader.Read())
{
//blah blah blah
}
}
Should we allow them to compile the code with out changing the code,
or on the other hand should you force them to use the more correct code:
public void Method(){
IDbConnection conn = new SqlCeConnection(connectionString);
IDbCommand sql = new SqlCeCommand("SELECT * FROM table", conn);
IDataReader dataReader = sql.ExecuteReader();
while(dataReader.Read())
{
//blah blah blah
}
}
We all agree that the second code is a more correct one since it
allows to easily change of db technology, but we can also agree that
there are the hell of a lot of programmers that do not use the
interfaces and use the objects instead. What I'm proposing is to
create the name space to avoid making people change their code when
compiling on linux, at the end of the day that would make the switch
easier for programmers, wouldn't it??
PD: I forgot to say that SqlCE runs on the compact framework as well
as on the full version, why??? I don't know, I suppose they want to
give it as an alternative for access db.
On 16 May 2007, at 14:20, Andreas Färber wrote:
> Hi,
>
>> I have already done most of the NUnit tests that the classes
>> should pass
>> and I'm testing them with the Microsoft dll. I'm thinking of either
>> creating the dll as a wrapper of the SQLite namespace (both databases
>> are file based) or simply finding a way to read the .sdf files.
>
> I'm not familiar with this assembly, but writing an assembly for
> SQL Server CE with an SQLite backend sounds rather odd because
> there already is an assembly for an SQLite backend and the
> System.Data architecture usually makes it fairly easy to switch
> between implementations using e.g. #defines. Also, as far as I know
> you can't compile from Mono for the .NET CF without serious hacking
> just yet.
>
> So, if you have to compile with Microsoft tools for CE then you can
> use the original Microsoft assembly. Otherwise you can use the
> existing and working data provider assemblies for code that's
> supposed to run on Linux only anyway.
>
> Just a thought.
>
> Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070516/a619614c/attachment.html
More information about the Mono-devel-list
mailing list