Subsonic adding a DB provider for Simple Repository - subsonic

I was wondering--what part of Subsonic 3 needs to be modified to support a different database under a Simple Repository scenario? I haven't found any documentation on this point. Subsonic 3 seems to be all about the T4 templates but when I check out the Subsonic project sources I don't see any T4 templates in there...so where/how do I add support for another database?
Thanks,
Alex

no part of SubSonic needs to be modified for SimpleRepo - just change your connection string and be sure to change the provider (part of the connection string) as well. So, the default connection might be:
connectionString="server=localhost;database=northwind;user id=bob;password=*****" provider="System.Data.SqlClient"
Change that to be the connection string you want, and the provider to your DB provider. MySQL would be something like "MySql.Data.MySqlClient" and SQLite would "System.Data.SQLite" (I think).
SubSonic will do the rest.

Related

How do you set certain spring.datasource properties in broadleaf

We are using the 5.2 version of broadleaf with spring-boot (using the tomcat connection pool) and mysql.
If there is no activity for a while, for example over night, it looses the connection and can't reestablish it. I have been reading about it and was aiming the use spring.datasource.tomcat.test-on-borrow and spring.datasource.validation-query properties but they don't seem to stick.
We have set up our other database properties in common-shared.properties like:
database.user=...
database.password=...
database.driver=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost:3306/broadleaf?useUnicode=true&characterEncoding=utf8
What is the correct way to handle this problem with broadleaf?
Sorry about that; the Broadleaf database properties are not related to those specific properties but rather the ones that you have there as database.user ... etc from the DatabaseStarter project. Setting spring.datasource.tomcat.test-on-borrow and spring.datasource.validation-query.
However, it looks like you are hitting the exact same issue that I resolved in this PR in DatabaseStarter (like for MySQL that you are using) and this PR in HSQLDatabaseStarter (which is the default you get). So, as long as you are using the latest GAs of Broadleaf (specifically at least 5.2.1-GA) you should be good to go.

How to do the Authorization in Asp.net by using Identity Framework?

For doing authorization in asp.net mvc 5 I have searched lot on internet but not getting correct answer. Actually I am using Visual studio community edition with .net framework 4.5.2 and mvc5. I want to do the Authorization in my project. My project is created with no authentication mode while creating a project.
Firstly I have tried these things:
I typed a command "Enable Migrations" on Package manager console.
Then I got one error like: Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel.
I dont know how to resolve this error. please help me to get out of it.
Which approach did you chooses to build our database model? Code First, Model First or Database First?
I'm asking because you can't use migrations with Model First or Database First approach. EF Migrations is a product targeted for Code First approach. CodeFirst assumes that you will never make any changes manually to the database. All the changes to the database will go through the code first migrations.
But there is solution for that - you can use Code First approach with an existing database. Take a look here: Using EF “Code First” with an Existing Database.

How to turn off Entity Framework CF Migrations for an environment

Is it possible to turn off Entity Framework using the web.config? In the application I'm developing we have the following environments
Development
Continuous Integration
Integration Testing
Production
The Integration Testing and Production databases are managed by a database administrator, so we have to send them a script to make changes to the database.
I've spent hours Googling and looking through old projects, and I can't find how to do this or remember if we ever turned off migrations on the old projects in the first place.
From the lack of information I'm doubting if what I'm asking is needed or possible, but there is something in the back of my head that's annoying me about this so I thought I'd ask the experts.
The easiest method is to simply delete the dbo._MigrationHistory table from these environments. If that table doesn't exist, then only an "initial" migration can ever be generated against that database, which will fail if someone tries to actually apply it to a database with existing tables.
You could set the database initializer in the config file as described at the bottom here, so you can have an updating initializer in the environments you want

Subsonic: Is it possible to use the oledb provider

When I set up a connection for Subsonic 3.0.0.4 to connect to an Oledb sql provider using the T4 Templates I get the following error: Keyword not supported 'provider' Can Subsonic access a database using OleDb? If so. How?
Which dbms do you want to use?
Since SubSonic 3 uses System.Data.Common for accessing data, it should be possible to use it with every dbms that supports ADO.net (I belive there is a OleDbProvider for ado).
But if you use a DBMS that is not supported by subsonic you have write your own DataProvider and an OleDb.ttinclude template file.
The beste starting point is to look at an existing provider:
https://github.com/subsonic/SubSonic-3.0/tree/master/SubSonic.Core/DataProviders/MySQL
https://github.com/subsonic/SubSonic-3.0-Templates/tree/master/TemplateProviders
Creating your own Provider shouldn't be to hard at all. I would use a Copy&Paste approach from an existing provider and modify everything that causes some errors.
I would use the standard SQL to LINQ Entity spaces but I have to connect to a database for a client through their application server's specific OLEDB provider. Apparently it's doing extra work after the standard OLEDB SQL commands are sent to the server. So LINQ as far as I understand is out. I built my own CRUD classes, but it's a pain doing it this way. I just want a tool that can build the standard classed so I don't have to create the layer myself.
It's MS SQL Server 2005 on the other end.

i want subsonic read database password from a variable instead of app.config

I have successfully implemented SUBSONIC DAL in my desktop application. it was superb experience. but subsonic reads database password from app.config file. as app.config deploy with application on client side, therefore its a big security threat.
It would be helpful if i can read database password from a variable instead of app.config.
Thanks in advance,
Regards.
The easiest and best way to protect connection string data is to encrypt the connection string section of the app.config
Read here http://msdn.microsoft.com/en-us/library/system.configuration.rsaprotectedconfigurationprovider.aspx
Dataservice.setdefaultconnectionstring() resolve my problem
The short answer to this is probably not going to happen because it would mean that either you need to add all the source files to your current project and change the way subsonic loads the connection string.
If you are worried about passwords being deployed to the client then it might be a better idea to use integrated security which works brilliantly.
Also you did not specify which version you are using , since modifying v3 is a little easier in my opinion

Resources