Re: [sqlite] sqlite.net (a.k.a. System.Data.SQLite) support

2014-06-22 Thread Sean McBride
You are using the straight SQLite classes to execute commands and such.  Why 
not use EF6 and use SQLite as a data source.  All the visual studio stuff works 
with it just the same a SQL server.  If you can use .Net 4.0 or 4.5 then that 
is the way to go.  You can use the EF 6 entity diagrams to design the DB and 
use EF 6 and LINQ to access it.  



> On Jun 22, 2014, at 12:36 PM, Baruch Burstein  wrote:
> 
> This is not technically sqlite specific, rather .net in general, but it
> came up using sqlite.net, so I am asking here. If someone can point me to a
> general answer elsewhere, that would be great, too.
> I downloaded and "installed" (read: copied) the files to my project. I can
> create connections, commands, etc. but how do I get it to recognize my data
> structure? I only need to display a single table (with editing) in a
> datagrid, but it is very frustrating when I don't have any of the famed
> Visual Studio support for my types. Even if I create a structure manually
> that represents a single row, how do I load the data into it? How do I bind
> the grid to it? How do I search? I am not very familiar with C#, and the
> little I have done always involved connecting to a "datasource", which
> auto-populates everything, from creating a class to hold a row to Linq
> intellisense support (I suspect the two are related). How do I get this to
> work if I "Xcopy" installed, as recommended on the website?
> 
> Basically, can someone point me to a resource on using databases in C# only
> via manual code?
> 
> Baruch
> 
> -- 
> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] .Net 3.5.1

2014-06-19 Thread Sean McBride
I would be eternally grateful if someone would help me with this issue.  This 
is something that I’ve been banging my head against for a while now.  In my 
current project, we need to support .Net 3.5.1.  This obviously means I cannot 
use SQLite EF6 support, but LINQ is still supposed to be supported.  But, try 
as I may, I cannot get linq to actually use the linq-to-sql module.  Some 
queries execute correctly, but the system is still using the SQLServer 2008 
linq-to-sql implementation that is the default for .Net 3.5.1

If I switch to .Net 4.5, everything works correctly, but with .Net 3.5 some 
stuff just doesn’t work.

Here is my connection code.  Nothing very complicated:

System.Data.SQLite.SQLiteConnection connection = new 
System.Data.SQLite.SQLiteConnection(“Data Source=AgentData.s3db”);
DataContext context = new DataContext(connection);   

And when I execute a linq command like this everything works fine and the 
SQLite DB is queried correctly:

var propertiesTable = context.GetTable();
var PropertiesSet = from a in propertiesTable
where a. Name == propertyName
orderby a.Name
select a;
foreach (var property in PropertiesSet)
{
Trace(property.Value);
}

However, when I execute certain code things just don’t work and throw 
exceptions.  Especially when dealing with auto number columns.

I managed to figure out by dumping the linq log that the reason is that the 
SQLite Linq-to-SQL code is just not getting invoked.  Here is the log output:
 
TRACE LINQ-SQL: SELECT [t0].[PropertyId], [t0].[Name], [t0].[Value]
FROM [Properties] AS [t0]
WHERE [t0].[Name] = @p0
ORDER BY [t0].[Name]
TRACE LINQ-SQL: -- @p0: Input String (Size = 0; Prec = 0; Scale = 0) 
[DatabaseVersion]
TRACE LINQ-SQL: -- Context: SqlProvider(Sql2008) Model: AttributedMetaModel 
Build: 3.5.30729.6404

Notice the "SqlProvider(Sql2008)” I believe this means that the linq-to-sql 
module that is getting invoked is the sqlserver 2008 translator, not the sqlite 
translator.  The code that generated this particular output (above) actually 
works fine because that particular SQL statement will run correctly in SQLite.  
But for other things, the SQL code generated by the translator is not SQLite 
compatible (for example if it uses the TOP keyword or a whole slew of other 
incompatibilities).

I know I have everything installed correctly because I am actually getting 
updates to my SQLite DB file.  But the app just throws exceptions wherever the 
SQL that gets  generated isn’t SQLite compatible.

Any idea how to force the Connection to use the correct Linq-to-SQL 
implementation?  Is there some configuration that I am missing that makes this 
work?

Thanks for any help anyone can lend!
Sean
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Provider not showing up in .Net Model import wizard

2014-04-24 Thread Sean McBride
Thanks for your reply Joe!

I think I am just not getting across exactly where I expect SQLite to show up.  
I am pretty sure it is supposed to be there because there are tutorials 
floating around that show screen shots with the SQLite source showing up where 
I would expect it to.

For example, in this tutorial: (specifically the 6th screen shot)
http://www.geekswithblogs.net/danielggarcia/archive/2013/12/22/portable-databases-ii-using-sqlite-with-entity-framework.aspx

It shows the .Net Data provider for SQLite in the drop down.

Any idea why this wouldn’t be working or what other step I am missing that 
would make this show up there?

Thanks
Sean 

On Apr 24, 2014, at 1:01 PM, Joe Mistachkin <sql...@mistachkin.com> wrote:

> 
> Sean McBride wrote:
>> 
>> I installed the NuGet packages (the one with all 3 modules) into my C#
> project.
>> 
>> I want to import an existing SQLite DB and create a Entity Data Model from
> it.
>> But, when I try to generate from database, the data source and provider do
> not
>> appear in the list.  
>> 
> 
> None of the NuGet packages for System.Data.SQLite install the design-time
> components
> for Visual Studio, since that would require various machine-wide changes.
> 
> --
> Joe Mistachkin
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Provider not showing up in .Net Model import wizard

2014-04-24 Thread Sean McBride
First, I am a long time SQLite user, (first time on .Net).

I installed the NuGet packages (the one with all 3 modules) into my C# project.

I want to import an existing SQLite DB and create a Entity Data Model from it.  
But, when I try to generate from database, the data source and provider do not 
appear in the list.  

I know this is supported because in some tutorials I have found I see screen 
shots where the SQLite Data source appears.

I am using VS 2013.  Did this break in the current version of VS or SQLite 
NuGet packages,? or is there possibly something I am doing wrong?

I haven’t done anything complex.
1.) Create new C# exe.
2.) NuGet the latest SQLite packages
3.) Restart VS and re-open my project (just in case)
4.) Add New Item: ADO.NET Entity Data Model
5.) Choose “Generate from Database”
6.) Click "New connection”
7.) Look for SQLite in the data source list (it isn’t there.  only SQL Server 
items appear in the list)

Thanks in advance!

Sean
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users