Hi *,i try to build a ASP.NET MVC app, which uses a model i created with
monodevelop and the tool Generate Linq class. I found some issues that i
could work around but at least the whole app won't run cause of the wrong
generated sql statements the ef context object creates.Step by step: ;-)I
installed postgresql on fedora 19. I compiled mono and monodevelop by myself
from git. I use the northwind sample db ported for postgres. Guess why? Yes,
I'm a MS developer since the late 80ies and i know northwind.1. I created a
Console Application under monodevelop and referenced System.Core,
System.ComponentModel.DataAnnotations, System.Data, System.Data.Linq and
Npgsql.2. The generate Linq class tool only works if i choose c#. It won't
generate a model if its using the default c# 2.0 setting!3. I added
following code to main:         public static void Main (string[] args)         
{               
Console.WriteLine ("Hello World!");                     NpgsqlConnection conn = 
new
NpgsqlConnection ("server=localhost; database=xxx; User Id=xxx;
password=xxx;");                        NorthwindModel db = new NorthwindModel 
(conn);                  //var
custs = db.ExecuteQuery ("SELECT \"CustomerID\", \n  \"CompanyName\", \n 
\"ContactName\", \n  \"ContactTitle\", \n  \"Address\", \n  \"City\", \n 
\"Region\", \n  \"PostalCode\", \n  \"Country\", \n  \"Phone\", \n 
\"Fax\"\nFROM \n  public.customers;", null);                    var custs = 
from c in
db.Customers                            select c;                       foreach 
(var item in custs) {                   
Console.WriteLine (item.CompanyName);                   }                       
Console.ReadLine ();            }If i run
this code an exception is thrown because the sql query which is generated by
ef is invalid for postgres. It builds a sql statement for SqlServer making [
] around column names. Why? Is there any switch in the config files i did
miss? Otherwise mono, ef and postgresql are not usable.....Greetings from
lower bavaria



--
View this message in context: 
http://mono.1490590.n4.nabble.com/Entity-Framework-and-Postgresql-tp4660138.html
Sent from the Mono - General mailing list archive at Nabble.com.
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to