Can you deploy/manage non-CLR procedures with VS 2010? - c#

Is there a way to store just .sql versions of your stored procedures in a project, then deploy them automatically to a SQL server? Every article I find talks about using a SQL CLR project, writing them in C#, then deploying them, which I can't do because my DBA won't enable CLR.
I am just looking for a way to add them to my solution so that they can be managed in svn, but not have to manually deploy them. Is that possible?

Visual Studio Premium Edition and upper allows you to create Database Project, store it under Source Control, Refactor and many other goodies..
Here is a great training on the subject by PluralSight:
http://www.pluralsight-training.net/microsoft/olt/Course/Toc.aspx?n=vs-db
And here is a blog post about it:
http://www.visualstudiotutor.com/2010/08/manage-database-projects-with-visual-studio-2010/

Related

Version control of software developed in Visual Studio

I have developed a WinForms application. Now I want to upgrade my application by adding new features and optimizing it. One way to do this is by just copying the project folder and making changes in that copied project folder. I want to know is this the proper way of version controlling in software development by just copying the project folder for every new version or are there some systematic methods available to manage all the versions of my application. I really want to learn about these things. Please guide me.
Azure DevOps (formerly Visual Studio Team Services, or VSTS for short) is a free* online Microsoft system which incorporates source control, a general overview of it can be found here. There are other systems but I'd highly recommend this as it ties in with Visual Studio nicely.
Specifics on two type of version control Azure DevOps supports are:
Team Foundation Version Control
Git
Git seems to be becoming the preferred system now, it's what Microsoft default to and my workplace has now moved to that setup.
Each system allows you to check-in or commit a code change that you make, keeps a history of these changes and enables you to roll-back to and view previous code.
Once you have learnt those basics start looking at branches/repos, when you start working alongside another developer on the same project I'd recommend doing some more reading to learn how to resolve merge conflicts and best practices to avoid them.
*It's free for up to five developers

How do I create an Azure Website and SQL Database programmatically?

Thanks for looking.
I have a need to be able to create new Azure website and database instances from a Windows forms application I have created as an internal-use tool.
I am not sure if there is a C# API for this or if I need to use Powershell or some other CLI, but I would appreciate any advice.
All of the searching I have done on the subject has not turned up a simple, direct explanation as to how to do this or if it is even possible.
Using Azure Resource Manager (ARM) API's is the way to go these days - especially with your scenario. You've probably seen documentation that uses the old Service Management API's to do this. You could still do this, but I would strongly discourage it. ARM is where the investment in automation is landing going forward.
For your particular scenario, there is actually a tutorial here.
If you are using Visual Studio 2013 or 2015, then you can also use the ARM templates that it provides. For example, from Visual Studio, select File > New > Project and choose the Azure Resource Group project template.
The next window in the new project dialog is where you can select from some common deployment templates, such as what you are looking for, which is a Web App + SQL Database.
This project will contain the ARM template that describes your environment and a script that you can use to invoke ARM to deploy it.
To deploy the environment, right-click on the project in Visual Studio and select Deploy. Fill in the parameters that the template provides and you are on your way. If you look in the script that is generated (Deploy-AzureResourceGroup.ps1), you will see at the bottom of the script a call to New-AzureResourceGroup. What this does is basically merge your ARM template and parameters together and then sends them to Azure Resource Manager to provision the environment. In other words, you have everything here to automate this without having to do it from Visual Studio.

Does Visual Studio Online keep a copy of my code if I create a project?

I would like to use GIT as version control on a Visual Studio 2013 project. It does however require you to create a project with Visual Studio Online. Does this mean that a copy of my code will be stored somewhere, or is the purpose of creating this project only to be allow other users to be added so that you can collaborate?
You don't have to use Visual Studio Online to use code control in Visual Studio. You can create the .git and use an external tool (like command line or source safe), or you can use the internal tool.
I think that the Visual Studio community edition struggles to create a git repo without being bound to the Visual Studio Online, but once its created, it works fine with various http remotes (I have a project here which uses two remotes, one being VSO and one being our gitlab repo that we use).
Storing your code remotely (but secured) on one of the major sites can be a major benefit to you in the long run. It gets you into good habits of committing and pushing your source, even when you're working alone.
VSO is basically a cloud-based version of TFS - Microsoft's source control, build and task management system.
In order to use the system for source control purposes, you need to use the "Check In" functionality on the Solution in the VSO project before the cloud-based version is updated. The initial project in VSO will likely be empty.
You can use VSO for collaboration but you don't have to.

how to make c# project with database independent of visual studio

I made a Backup and restore project on visual studio , along with another project. They both use the default database of visual studio. They both have to bundled together along with the database, so it runs without Visual studio. I have tried to use the default VS installer, but i don't think that allows me to use the database aswell.
I have decided to use NSIS to make the installer. What all files, libraries etc. do i need to make the database and project function together, independently(without visual studio). How can i do this ?
Thanks
What kind of database do you mean? MS SQL or MySQL or another?
E.g. to create MySQL database from NSIS you can simply run command line utility and pass your sql script as parameter so the utility will create everything what is in the sql file.
Other database types simply need to extract their database file somewhere to disk and set appropriate paths.
Your question is very vague, there is more details needed to answer you.

Cannot see Oracle Data Provider for .NET in Visual Studio 2012 RC

I am porting a web application to Entity Framework 4.5. My main goal is to support both MSSQL and Oracle databases and be able to tell the ORM which data source to target programmatically (in the Global.asax). The SQL and Oracle schemas are obviously functionally identical; this is an approach we already use in production with another ORM we want to throw away.
NOTE: The machine we are testing it on has Windows 8 Release Preview Build 8400 64 bit, Visual Studio Professional 2012 RC 11.0.50706.0 and .NET framework 4.5.50501. It is not a standard development machine (the others have XP and 7 w/Visual Studio 2010 and .NET 4), but a new one we are using to test these new technologies. I have no idea if any of this new technologies may be the problem, haven't tested it on a "standard" dev machine yet.
Short version
I'll explain the situation in detail right below, but the main questions are:
In the "Add new ADO.NET Entity Data Model" wizard, I cannot see the ODP.NET data provider I installed (see below) and thus I cannot create a model from an Oracle database. Why? Furthermore, in the "About Visual Studio" pop-up I don't see listed Oracle Developer Tools for Visual Studio. My fear is that the Oracle Developer Tools aren't working somehow, but the Oracle Universal Installer said everything was correctly installed (and I rebooted several times).
What is the best practise to achieve this requirement?
Long version
First, we created the Entity Data Model from a SQL Server database. So far so good.
Then, we installed ODAC 11.2 Release 4 and Oracle Developer Tools for Visual Studio (11.2.0.3.0) from http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html
I have managed to initialize our model, SIAEntities (which inherites from ObjectContext), with:
System.Data.EntityClient.EntityConnectionStringBuilder builder = new System.Data.EntityClient.EntityConnectionStringBuilder();
builder.Metadata = "res://*/SIA.Models.SIAModelOracle.ssdl|res://*/Models.SIAModel.csdl|res://*/Models.SIAModel.msl";
builder.ProviderConnectionString = "data source=***;persist security info=True;user id=***;password=***";
builder.Provider = "Oracle.DataAccess.Client";
SIAEntities db2 = new SIAEntities(builder.ConnectionString);
where SIA.Models.SIAModelOracle.ssdl is a custom written file (embedded resource) which overrides the SSDL part of the .edmx and has the following modifications:
Provider attribute of the root Schema node set to Oracle.DataAccess.Client
All data type names converted to their Oracle equivalent (datetime > date, nvarchar > varchar2, image > blob, etc)
An oracle.dataaccess.client node added in the web.config which maps bool to number(1,0) and tinyint to number(3,0)
The error arrived when executing the first query (a simple SELECT): I tracked it as being due to the double quotes in the query that gets executed against the db, forcing it to be case-sensitive.
By manually editing the custom .ssdl file and uppercasing everything I can let EF "see" the table and recognize a column after the other, but I didn't push this solution too far (thus stopping before getting to read the whole table) because a) it didn't seem too clean b) I have difficulties understanding the links between the .ssdl and the .csdl/.msl parts so I wasn't sure where to uppercase and where not to!
Another strategy I was contemplating to avoid this manual work could be to try and generate a separate model from the Oracle schema and wrap the two ObjectContexts with another class that handles the choice between either of them, but as question #2 says, I cannot do that.
Edit: Oracle has now released a version (11.2.0.3.20) of Oracle Developer Tools for Visual Studio that works with Visual Studio 2012 and .NET 4.5. You'll need this version (or higher) of these tools for Visual Studio 2012 Entity Designer support and other Visual Studio 2012 integration. Get it here:
http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html
Edit #2: Visual Studio 2013 is supported beginning with version 12.1.0.1.2
FYI - I created a video to highlight some of the other features of these tools:
http://www.youtube.com/watch?v=68tlel4iJdM
Christian Shay
Oracle
Oracle has released ODP.NET with VS2012 and .NET 4.5 support. I don't see much from them in the way of documentation for this release.

Categories

Resources