Stop EF Database Initialization for DefaultMembershipProvider - entity-framework-4.1

Team, I have an ASP.NET MVC application that I'm deploying. When I deploy it the application works fine, but when I call Membership.CreateUser it ends up trying to create the database even though it already exists. What do I need to do to get it so that it will not try to call CreateMembershipEntities since the database already exists?
I've tried Database.SetInitializer to an initializer that does nothing, I've tried removing the defaultConnectionFactory in the Web.config - I'm currently out of options.
I look forward to your help!
UPDATE
I just found out yesterday that the reason it's trying to create the database is because the hosts servers do not allow the connection to query sysdatabases and so the database never exists and is hence always trying to create it. It appears that I may have to go back to the old fashioned AspNet membership provider and also go away from the EF code first model.

give a look here: http://www.qualitydata.com/learn/web-config-membership-provider-settings
It shows the Membership configuration section of the web.config. You have to write a similar section and put connectionStringName="Your Connection String". In your connection string you specify the informations of the already existing database.

Related

The JPA Buddy Reverse Engineering tool is not showing tables

When I click from "Entities from DB" it correctly connects to DB, and it succesfully performs the introspection, so that I can see the list of tables from the side view. But within the popup I get 0 tables, 0 views and 0 mapped relations
0tables
I tried disabling cache and change some settings, and also restarting, but with no luck.
How can I solve the problem?
For MySQL, you need to explicitly specify the schema name in the connection string to make JPA Buddy work. 
Even though IntelliJ IDEA allows you to create a data source without specifying a target schema or even a database, JPA Buddy can only get data from an explicitly specified connection string. This limitation comes from the fact that we use JDBC driver to obtain meta information. So, in case your tables are located in the non-default schema, you need to create a new connection targeting the database and schema, as explained here https://www.jpa-buddy.com/documentation/database-connections/#non-default-schema-connection.

duplicate objects in sql server

This is a long story and I am a little bit stack, I have tried many things and I was able to move forward, question is what now?
This is the full story:
I started working in a .net core project, 2.1. I installed for that visual studio 2019 and other tools. The important thing is that I installed SQL Server 2017 developers edition (the free one) with the default parameters, that version created an instance called MSSQLServer. Unfortunately, the project needed a different instance name which was MSSQL2017, so I tried to change the name of the instance, I couldn't because it is a free version, reinstalling it did not work either and a few other things that I tried, the important one is that a colleague changed the default sql string to make it compatible with my installation, in order to see if the problem was the setup or something else. It worked, and the tables and database was created for that project. So I managed to create another instance calling it with the proper name MSSQL2017, created the users and so on. When I go to Ms SQL Server Manager Studio, I notice that the tables are not created, so I run profile and run the project again, and this is what I get 'Cannot insert duplicate key row in object 'sys.syssingleobjrefs' with unique index 'clst'. The duplicate key value is (67439, 76, 101).' and that's when I am lost, I can't find what sys.syssingleobjrefs refers to so I have no idea how to move on to fix this mess. Any help?
update: so sys.syssingleobjrefs is a system base table, that I can't see its content, how do I modify it?
select * from sys.syssingleobjrefs does not work
syssingleobjrefs is a system table accessible only through Administrator mode.
You have to use sqlcmd -A in order to access this table.
https://learn.microsoft.com/en-us/sql/relational-databases/system-tables/system-base-tables?view=sql-server-ver15

Dealing with datasources in grails in connection with BootStrap.groovy

I'm currently developing a new project in Grails and right now all the information concerning datasources is within DataSource.groovy. I have also got some code in BootStrap.groovy in order to initialize the database in case of the first start in order to fill some tables with constant values.
Now I'm wondering how I could realize some kind of an "installer". I'm thinking of a customer who uses the .war of my software and needs to configure the database parameters (URL, user, password) before the first start.
I was thinking about setting up a dummy database and later let him change the URL, user and password via a webpage as part of my software. But what will then happen with my BootStrap-code in order to initialize the new database? Or is there a possibility of let the user set the necessary parameters before the BootStrap-code is executed and create the new database as well? Would that be possible to realize within grails or would I have to place some php-code up front?
I'm thinking of using grails, mysql in connection with database-migration plugin.
I would be grateful for any advice on this behalf. Thank you in advance!
If something is unclear, please tell me so.
I highly recommend you consider using an external configuration file that will allow your customers to not only configure the data source(s) but any other aspects of your application when they deploy it.
The Grails documentation has detailed information about how this is accomplished.

how to create liferay Table in mySql?

how to see my liferay table in mysql database?
i have created portal-ext.properties in liferay home.but i cant see my liferey table mySql..
table is created in docroot/web-inf/sql in eclipse IDE...
help me where i m wrong and which thing missing?
#
# MySQL
#
include-and-override=portal-ext.properties
include-and-override=${liferay.home}/portal-ext.properties
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/kportal?useUnicode=true&characterEn
coding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=ubuntu123
schema.run.enabled=true
schema.run.minimal=true
Tables created through service-builder will only be created once you deploy your plugin to the actual server (and run the server), not on build time. Also, your plugin needs to deploy correctly - if initialization fails (e.g. due to missing pieces or dependencies that are not met), the tables will not be created.
Also, the tables by default will be named with the namespace you gave as a prefix. So if you declare a namespace X (in service.xml) and an entity named Y, the table to look for will be named X_Y.
Also, remember you'll have to run ant build-services after you edited your service.xml. Then deploy it and wait for a log message similar "...your plugin... is available for use" to be sure it deployed correctly. (Edit: This is no longer printed for portlets, only for the other plugin types, so you might not see it when you deployed your plugin)
If this doesn't help, please give more information. Currently you don't give any details about what you've actually tried. You'll find more steps and details on the development guide.
Also, make sure
that the account you use for the database has CREATE TABLE permissions (you use root in your configuration above - that should do the trick)
that you're checking the correct database in case you have multiple
that Liferay actually picks up your configuration file. The startup log will tell you which portal-ext.properties files are read, as well as which database it will use. In case you can't find the name/location of your portal-ext.properties file, make sure that you indeed have a file with this name. A common problem on windows is that people create portal-ext.properties.txt (and Windows hides the .txt part of the name)

Entity Framework 4.1: Code first error: "the model backing the context has changed since the database was created"

Im creating a database via a "code first" application, the sql server contains no databases.
The application runs fine, creates the database and seeds the data i have defined in my initializer.
a service i have running tries to add some data to the database for the first time. i get the error:
The model backing the 'yyyContext' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance. For example, the DropCreateDatabaseIfModelChanges strategy will automatically delete and recreate the database, and optionally seed it with new data.
There should be no changes since the database was created and when then service runs.
I'm running EF4.1, and the database doesn't exist so unlike questions with similar titles:
Database.SetInitializer<YourContext>(null);
Isn't the solution for me.
Any ideas about what could be wrong are welcome.
Doh! moment, turns out the service wasnt using the same connectionstring as the other app.
the reason the databases didnt look the same must be because earlier in development i started the main app with no connectionstring aswell, so it provisioned a local instance database for itself to use.
Then later when i was trying to use the service, it was trying to access the same database from earlier, and the model changed significantly since then.
I pointed the connectionstring to the correct database and everything worked from there.