.NET - Database deployments similar to Rails - c#

I have a .NET application that uses a database. I am familiar with how Rails handles database deployments where there is a set of scripts that have an 'UP' and 'DOWN' method with a set of SQL in each to deploy/rollback changes to your database. The rake command will then execute these scripts in order.
I was interested in a similar process for my .NET application and was hoping there was something similar already written. I don't think it would be hard to write my own to do this process, but I was hoping to avoid re-inventing the wheel.
Thanks for any direction.

Try Migrator.Net if what you want is rails-like migrations with simple up/down methods for adding/removing tables, columns, indexes, keys etc, and written in C#/VB etc.

There is the Tarantino project, that aims to solve this problem.

Look at Visual Studio Database project

Visual studio supports a database project type that has folders that can contain "Post-Deployment" and "Pre-Deployment" scripts to run. MSDeploy may then be used to execute these scripts (as well as other DDL) during the deployment process. Here is the documentation on MSDN regarding the use of Pre- and Post-Deployment script definition.

Here at Red Gate, we're currently building in a migrations feature into SQL Compare and SQL Source Control. If you're interested and you'd like more information on how this will work, please email me at David dot Atkinson at red-gate dot com. We're keen to get some feedback on our ideas.

Related

Documenting and consuming Architecture Decision Records in TFS

This pertains to Lightweight Architecture Decision Records and its usage in TFS with consumer tools in TFS/Powershell.
Based on what exists today
https://github.com/npryce/adr-tools
I wanted to find if there is a corresponding .NET library or project for usage in TFS.
No that I know of.
The tool you reference simply creates some formatted text files; converting similar bash scripts to Powershell is not that hard, so you can do it and share the result with the community publishing your repo.
If you want to create custom work items to track this information, you can do as well. There is plenty of sample code around like Igor's Powershell Cmdlets.

Tracking All Code Usage In ASP.NET Web Application

I have been tasked with taking an existing asp.net website that has many lines of code and projects and redesigning it. I would like to know if anyone has any ideas on how to track every method/property that gets called when users are on the site. I would like to identify the code used the most so that I can know what I should carry over to the redesign, and what code is not used at all and can potentially be removed completely. Many thanks in advanced. There are both vb.net and c# projects in the solution, so any solution would have to support each language. Also, any free/oss solutions are the best for me right now.
I am currently using VS.NET 2015 Community, if that helps. :-)
You can do it in multiple ways:
Introduce some method level tracing by using some AOP framework (like PostSharp). In this case, you can log the method call chain of one specific request. Then you can start from there.
If your app backed with SQL Server, enable profiling and look through all SQL queries executed from one request. Then you look back to codebase and refactor them.
Use CodeMap to understand code base and do it.
You can use ReSharper. Right click the project and select 'Find Code Issues'. You will see 'Unused Symbols' to show which components are not being used.

Import data into sql server from files with different format

I have a program, which watches a folder on the server. when new files (flat file) come in, the program (C#) read data, bulk insert into the table. it works fine.
Now, we extend the system. It means the data files could be in different formats (flat file, csv, txt, excel..), or with different columns (we need map them to the columns in the table).
my question is: is C# the best choice for this? or, SSIS is a better choice?
Thanks
I wouldn’t necessarily choose one or the other but choose depending on the file type and the amount of processing. For some file types its probably easier to go with C# and for some other SSIS works better.
Do you have someone on your team who is good with SSIS? It’s much easier to find a C# dev to do the job for you than to find someone who knows SSIS.
How likely is that requirements/formats are going to be updated in the future? That’s also important thing to keep in mind.
I do agree with what others said that SSIS is more powerful and offers support for more complex transformations but the questions is do you really need this?
It's depends on your context. Different format should not decision go to SSIS. With solution C# program: you can continue go with it because it run stable before. Easy to deployment, specific into your domain, easy to configuration as well.
With solution SSIS: The configuration more complicate required developer has deep knowledge into SSIS. The administration fee required more than C# program. However it easy to visual (has diagram for you see the flow integration more easier).
From my viewpoint, if the integration process does not required complicated about business rule you should go with C# program. Otherwise, SSIS more powerful if integration process required rules complicated. Hope this help.
In C# application I guess you are using the SqlbulkCopy component and compared to SSIS its not that powerful. So if your data size becomes huge,then C# application will become slower.
If you are familiar with SSIS,my suggestion is to go with SSIS. In SSIS,you can implement end-to-end solution as you have developed in C#,right from checking the files in a specific folder to loading the data into database.

Easy update assistance

We are writing simple architectured software in C# 3.5.
What I was searching for is for easy updating framework/application...
We don't have COM components, Servicdes to install or whatever, so basically what we need is xcopy stuff form one Server side directory to the client. So what the program should do is like a workflow:
Check some location \Server\Updates for manifest.xml
Check the local setup verison
Download all available DLLs (doesn't necessary all need for complete application, so kind of patch stuff) and substitude them with "old" ones.
I'm aware of ClickOnce, of App publishing, also our setup generator supports autoamtic updates (even if noone yet used it, and I don't want to use to not strongly couple ourselfs with that technology).
Do you know some app or technology, that I'm not aware (actually listed in question) which could better fit our needs. ?
Thank you in advance.
So, after the comment, the answer:
I would look at this SO post.
I looked wyWuild and the AutomaticUpdater controler some time ago. It really looked great.
EDIT
I just remembered that I chose to use AppLife Update in the end. It's more expensive but the features are extremely good

MSBuild in a Client Environment

I'm wondering if anyone has some solid advice for me. I'm trying to see if MSBuild is an appropriate tool for a client-side application (sold, commercial product). For example, if on the client machine there is .NET 4.0 and my program, I want users to be able to create screen savers and save them as an EXE.
So far, all I've seen is MSBuild being used for ASP.NET and build machines in a controlled environment, but is it appropriate to use it "in the wild" for a scenario such as described above?
I can't advise whether it is appropriate or not in your particular case, but since it is included in the .NET Framework setup, it is reliable to use it.
Overkill
MSBuild is great for managing complex projects with many interdependencies. If all you want to do though is generate an EXE from a simple set of inputs, like the screensaver scenario you used, I'd just use the C# APIs for calling the compiler or call csc.exe directly.
What you have to ask yourself here is how transparent you want msbuild to be? I would not advise using a command line and giving clients these commands and parameters, but if you mask it and have a good presentation layer that keeps all the technical stuff hidden then it's a pefectly good idea.
My current project relies pretty heavily on msbuild when installing, it works great and no one would know unless they seen the code.
Hope this helps.

Categories