jamesej / lyniconanc

Lynicon CMS for ASP.Net Core for .Net Standard 2.0/2.1 and .Net 4.6.1/4.6
http://www.lynicon.com
Other
190 stars 28 forks source link

Postgres #12

Closed OkkioXavier closed 5 years ago

OkkioXavier commented 5 years ago

When I try to run this against a postgres database I get exceptions related to the connection string. Are there any instructions on how to get this working with postgres?

System.ArgumentException: Keyword not supported: 'port'. at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary2 parsetable, String connectionString, Boolean buildChain, Dictionary2 synonyms, Boolean firstKey) at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms) at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)

Thanks for the help!

jamesej commented 5 years ago

Have a look at the answer here: https://stackoverflow.com/questions/45217166/c-sharp-entity-framework-keyword-not-supported-port and see if it applies to your situation. In any event, it's doubtful this is an issue with Lynicon rather than with how you have your providers set up for Postgres.

OkkioXavier commented 5 years ago

Hey James. I've taken a quick look at the source code and it seems that PreloadDb is set to UseSqlServer by default as is CoreDb.

https://github.com/jamesej/lyniconanc/blob/0660af03c52459e36b03d68e1e06e34a08c0b3f5/src/LyniconANC/Repositories/PreloadDb.cs#L23-L31

So I figure that the CMS itself needs an SQL Server install but when you create your own types to manage you can provide any type of context.

Going to try out your file based system instead. Thanks for the help!

vector-man commented 5 years ago

If it requires SQL Server, is there a way to completely swap that out for postgresql, so it has no dependency on SQL Server at all?

jamesej commented 5 years ago

I've had a look at the code and while our intention was to expose the flexibility of Entity Framework with regard to data sources, it does seem we tied the system down to SQL Server while making the transition to .Net Core. It's a minor rework to reexpose this so we will allow configuration of a standard set of database options in Startup.cs. Should be done within a week or so. That will allow anything supported by EF to be used.

jamesej commented 5 years ago

Although in principle we have this done, we ran into an issue testing with MySQL where the query translation seems to fail. Not sure whether it's in our code or the Oracle provider. Will release changes once resolved.

jamesej commented 5 years ago

This is now resolved and tested against SQL Server and MySQL. It should be possible to run against Postgres with an EF Core provider such as Npgsql.EntityFrameworkCore.PostgreSQL. This is documented athttps://lynicon.atlassian.net/wiki/spaces/LAC/pages/363495425/Installing+to+a+New+Project+-+VS2017+.Net+4.6.1+.Net+Standard+2.0+Core+2.1, partway down the page as an optional step.