asp.net mvc code first set database version - asp.net

I'm using the aps.net mvc 4 code first entity framework.
If there's no database, my application creates the databases as it should.
The problem is, that they are generated in the version 706 (Sql Server 2012) but I need it as an older version, so I can run/handle it with Sql Server 2008
Is there a way to configure in which version the database is generated?

If I can remember now I think the attribute you are looking for is ProviderManifestToken.
Have a look at this article for how to change it.

Related

Connect Azure database to existing Asp.Net web application

I'm actually working on an university project and have to figure out how to connect my windows azure database to an already existing ASP.net web application project.
The web application should run on smartphones and tablets.
Since this is a group project, we use TFVC to manage the project.
Our client supplied an mysql script that will create the tables needed.
The Database is hosted in Azure and we want to access it through Visual Studio ultimate, so we can reveice data from the DB and integrate it's data in the application.
I also got the connection string, so I could use it if needed.
So my question is:
How can I connect to the database through visual studio and afterwards: how can I access to it? With access I mean, how and where can I use SQL queries in Visual Studio?
I don't really know where to start, whether it is connecting to the DB via code or on another way.
Every kind of help is welcome.
Thank you in advance.
Your question is still quite vague on specifics of what you want to achieve but hopefully this answers it. If not, please provide even more detail on your question.
If you just want to see the DB in Visual Studio and interact with it
Download the Azure SDK
Go to Tools > Connect To Database
A side box will open and you can navigation through Azure then to your database.
Personally I prefer using SQL Server Management Studio, its much more responsive that the UI through Visual Studio.
If you want to connect your application to Azure, as in code an application that talks to a database, then you just need to replace the connection string in your Web.Config to your Azure Connection String. Then either use ADO.NET, Entity Framework or another ORM.
I recommend Entity Framework but it all depends on what your circumstances and project requirements are.
If the DB already has its schema defined get started here:
https://www.asp.net/mvc/overview/getting-started/database-first-development/setting-up-database
If its empty you can use code first:
http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application

asp.net mvc example with db

I know the basics of MVC. But I am looking for an asp.net mvc example with db.
The following example explains the same - but the db is within the app_data folder. But in real practice, as u know, we will use an external SQL server for this
http://www.asp.net/mvc/tutorials/older-versions/movie-database/create-a-movie-database-application-in-15-minutes-with-asp-net-mvc-cs
Can u pl site an example - which explains asp.net mvc with db (just save & retrieve)
It might not completely meet your question but it is quit usual to use Entity Framework or NHibernate to manage your database
See ASP.Net site or the Entity Framework tutorial
Maybe you can find some other answers at that site.
There is no difference on the mvc side. You just have a different connection string to point to a sql server instead of a file inside app_data folder.
Create the same database on you local sql server express and change the connection string to point there. You'll see that will work the same.
In order to make your life easier, you can download SQL ServerManagement Studio Express (this is 2008 version)

How can I obfuscate database authentication info during open-source development?

I'm working on an open-source web application that will retrieve and display data from a database whose authentication info I would like to keep under wraps, but at the same time, I would like anyone to be able to view and contribute to the source code. The idea is that we don't want the database to be used for profit.
Is there a way to make the database schema public, but only have a few rows of each table actually visible outside of the production server? I'm using ASP.NET MVC 4 in Visual Studio 2012, hosting the code on git, and publishing to Windows Azure. I'm also using a pre-existing Microsoft Access 2007 database.
You could encrypt the connectionStrings section of the Web.config file.
How you do that is described here. The connectionStrings section would not be decryptable on any machine except the server. It would be rather inconvenient for other developers though. You could set up so that this connection string is only used when the web site is published using transforms.

What parts of asp.net, c# and database should I use to create a forum like stackoverflow?

I am a fresher and I have got a project in asp.net and c#. I have to create a forum, something like stackoverflow, so I have studied asp.net, c# and sql server 2008 but now I am unsure how I should start work on this project.
What technology and what part of asp.net, c# and the database will I use more? I have 3 days to study so I want to know which parts of asp.net, database and c# I have to cover in 3 days.
It's my first live project, will I have to study any other languages or are the ones listed enough?
Session management, good understanding about web controls and user control.
and just go throgh ado.net if u are using asp.net.
Maybe you should try to use ASP.net mvc check this link.
If you are going to use sql server as database / Backend of you application than
start getting infomation about linq to sql >>
LINQ to SQL: .NET Language-Integrated Query for Relational Data
or you can also go for entity framework
The ADO.NET Entity Framework Overview

ASP.NET MVC 2 Embedded Database

I am building a very small temprorary website that needs a small backing store. I have built this in ASP.NET MVC 2, and wanted to host with DiscountASP - although this isn't essential.
I would like an backing store that will work with ASP.NET MVC 2, VS2010 Express, enabled LINQ (or EF) and work without further charges on a shared host.
From my investigation, SQLCE 3.5 doesn't work in .NET 4
SQLCE 4, is only CTP and doesn't work in VS2010
SQlite doesn't have any .NET 4.0 drivers.
HAve I got this right? Any good tutorials or blogs that show how to get this working step by step?
Thanks,
Mark
SQLite does work on .Net 4.0. Here are some other very similar questions about embedded databases in .NET:
Good embedded database solution (like SQLite) for .Net
Embedded database for .net
Open Source Embedded Database Options for .Net Applications
I'm not an ASP expert but have you heard about Firebird SQL? Database engine which has client/server or embeded versions, fully featured with transactions etc. and with ADO.NET provider
http://firebirdsql.org/dotnetfirebird/
http://firebirdsql.org/index.php?op=devel&sub=netprovider
No, Dont even think about using firebird embedded in ASP.NET.
It is strictly forbidden.
here's a reference on Firbird website tell you to avoid:
Is it possible to use the embedded Firebird in my ASP.NET application?
Yes. But Firebird ADO.NET looks for the fbembed.dll file in the application working directory. For ASP.NET application the working directory is the system folder (e.g. C:\WINDOWS\System32). But it's not without problems
link text
On Another page from the same website:
ASP.NET uses a feature that help against poorly written ASP.NET application to block the entire server - it recycles the ASP.NET working process both regularly. By default, IIS6 uses overlapped recycling where there is a new process started before the old is stopped to ensure uninterrupted operation. The problem is that the fbembed.dll exclusively locks the database for the owner process so if you run another process simultaneously the database won't be accessible before the first process stops. You might want to accept this but it really is not an optimal solution.
The solution is to turn off the overlapped recycle (by setting the DisallowOverlappingRotation metabase property to true). However, this might cause outages of your application during recycle.
Conclusion
Don't do tha**t ;-). Really, fbembed.dll **was not built to handle such use. You can make it work but it is just a hack.

Resources