I'm starting a new, large server based project using .Net 4 and Visual Studio 2010. I've done this many times before (with various versions), but I've never found a good way to maintain my database. There's been a lot of new technologies in the past few years to make this easier. However, there is one thing I haven't found: A technology/framework that can automatically update a database based on a model, without regenerating the entire thing and losing all the data. Can anyone point me in the direction of anything like that?
If not, can anyone point me in the direction of best practices for such development? We've got one development DB, one test DB and a production DB. I would like to be able to just run some auto generated script or code to update a database according to the latest model. I know that certain changes are harder to track than others, but at the moment about 95% of changes to the schema are added tables or columns. Those changes should be possible to auto generate script for - right?
Any help in helping me get this database off to a good start will be much appreciated!
Have you tried Visual Studio Database Projects ?
http://social.msdn.microsoft.com/Forums/en/vstsdb/thread/5c0b6d10-47eb-4c11-885d-722df86f02ec
automatically update a database based on a model
This sounds very much like Ruby On Rails data migrations. There are a couple of projects that will help with this, for .NET:
RikMigrations
MigratorDotNet
Related
First, a little background to our situation. Several years ago I started an ASP.NET MVC project using LINQ to SQL as the DAL. Being the only developer on the project at the time, I chose to use it because it was pretty well supported in the community and I needed to focus more on the application logic and UI design so I could get it to market. That strategy worked out quite well for us.
It wasn't long, though, until I needed to write some multi-threaded code in a Windows service against the same data store. LINQ to SQL encountered all sorts of problems with crossing threads. Still being the only developer at the time and needing to get this service up quickly, I resorted to duplicating just enough of the DAL and models using POCOs and Enterprise Library. Though not ideal architecture with duplicate models and DAL functionality, it worked well enough and got me through.
That was five years ago. We've been successful with our project to the point where that very success is now a liability not with LINQ or Enterprise Library, but with SQL itself. Now, before anyone suggests that we give our SQL database an overhaul with indexes and all of that, we have done exactly that. We added a DBA on contract and he solved the problem for us. Performance was restored and things were okay. The problem, though is that it requires (in our opinion) too frequent maintenance for our business model and requirements.
Thankfully, Microsoft has stepped up their game with Azure services. Of specific interest to us (we have two developers now), is DocumentDB. In SQL we have several large, flat, busy tables that give some areas of our application severe performance problems when we start to approach the need for DB maintenance. We simply don't have the resources to devote to ongoing maintenance. We've decided to move our application either in part or entirely to DocumentDB. A few proof of concept demos internally tell us that this is a good move for the type of application we have.
If you've read this far, thank you, and here is my question. What would be a good way to migrate the LINQ to SQL classes and generated logic to a DAL backed by DocumentDB? Thankfully, I had the foresight early on to use an IRepository approach such that the application itself won't be impacted, hopefully at all. I'm mostly concerned with all of the "magic" CRUD stuff that the LINQ to SQL design surface coded for me. My other developer and I certainly understand how to write our own DAL code, but we need a quick and consistent approach that takes into account the behavior that the application is coded to expect from having been backed by LINQ to SQL.
My instinct is to basically unwind all of the generated code that LINQ to SQL did for me five years ago and divorce it from the LINQ to SQL designer, add in our own DAL via DI and go from there. My other developer is more advanced than I am on that part of things, so I have a pretty decent amount of confidence that we can get it done. Just hoping somebody out there can help us avoid pitfalls so we can get this done efficiently.
As David Makogon points out in a comment, this question really has no "correct" answer as it is very broad and opinion-based. I'm getting a broad range of suggestions, but nothing I would consider a definitive answer.
Background
In our environment, we are constantly making changes to our work item types (WITs), due to changes in our procedures. We currently have two main collections; one collection has around 5 projects, and the other one has around 20. For each project, we have 7 different WITs.
It gets kind of cumbersome when I have to make the a change to the templates, because I have to change them on every project/collection that we have. Typically, I just modify one template, and use the command line (witadmin) to import that xml file into each project. It's really difficult to know whether or not WITs are current on all projects.
What I am looking for
I would like to find a way to easily modify the WITs once, and have
it update all of the projects with those changes.
It would also be nice to have a GUI to modify these WIT. Does TFS 2012 and TFS 2013 handle WIT modification better?
What I Already Know
I am pretty comfortable running TFS/DOS commands, so I ultimately could
create a batch script that would automate that for me. This would
probably be a last resort scenario.
Another option would be to write an app using the TFS SDK and import the WITs to all projects.
Current Configuration TFS 2010 and VS 2012 (We are soon upgrading to TFS 2012)
Fortunately Grant Holliday did an excellent post on that topic.
A quick method is automating your WIT export\import with batch files (ExportWITDs.cmd, ImportWITDs.cmd). Then use the Checkin.cmd example to check-in the changes to a dedicated folder for WITs on the source control.
If your'e looking for a tidier, more robust solution, go for the TFS-SDK. A Visual Studio extension that adds an Export\Import\Sync All WITs buttons would be great.
Is it possible to embed the Visual Studio 2010 report designer functionality into my WPF application?
Initially I was considering the use of Report builder, but for providing ad-hoc reporting capability from within application, I need to teach users too many steps before they start creating a simple report. So I am now thinking of simplifying it by embedding the report Designer (if it is possible), and do all the basic steps programatically and show the design surface and Data objects on the left.
Any help is appreciated.
I have not found any good way so far and decided to use Report Builder instead. The approach I took is to build a report skeleton programtically with connection and query embedded in the RDL to expose object model instead of tables and views and launching the Report Builder to open this RDL. Yes.. there is lot of overhead that I need to build a query with lot of unnecessary fields and joins and the resulting performance is terrible. In a future version I will come up asking the users the fields they need to use int he report to improve performance.
Looks like Microsoft is going to make customers pay for SSRS from 2012 version. So this choice of use SSRS may even b ruled out.
Years ago (pre-web) I used to be a Fortran developer (yes it was a very long time ago!) but these days I run a small non-IT business. I would like to develop a database application for my clients to access via a browser (or maybe down the line via a mobile phone). I haven't done any programming for a while apart from some VB macros in Microsoft Excel. I would be grateful if anyone could suggest the best language/technology to learn to get me heading in the right direction.
As Neil said in his comments there are dozens of different, valid answers to this.
Usually I would suggest going with a language you already know, but neither Fortran or VBA are really suited for this task, as far as I know.
Personally I would suggest Django, which is a web framework written in Python. It simplifies many common tasks and it is very well documented.
But there are many more possible solutions.
Before I started with a framework I'd break the problem into pieces. If you've never done anything with a database before you'll find that challenging enough without piling web or mobile on top of it.
Model your problem and get a good object or data model in place. Test that thoroughly without thinking about UI. Once you have that, perhaps you can expose it as services that any UI can call.
You'll quickly become overwhelmed if you try to do it all at once.
Here's another thought: If these are paying customers, why not do yourself and them a favor and hire someone that knows how to do this? It's great that you used to write Fortran, but if you haven't kept up you won't be doing your business any good by putting out a bad first effort for customers to see.
Do it right - get a professional. Do your learning on your own time.
You can use ASP.NET and SQL Server to get something online that will allow users to edit a database table fairly easily. They've simplified it to the point where you can drag and drop the necessary controls (GridView and a SqlDataSource for instance) and define your datasource in a wizard for most simple table CRUD functionality. Basically give users the ability to edit a table without writing any code.
If you need to do something a little more difficult it's easy to write code that will add functionality to the original drag/drop stuff you did.
There are lots of good resources out there for asp.net and C# also, so it will help you get up to speed quickly.
Keep in mind that I work almost entirely with .NET/SQL Server so my opinion will be slanted towards them...
Does anyone know of a simple WPF or Silverlight framework which enables you to e.g. define some database tables in e.g. SQL Server compact database and then the framework automatically creates the Window classes etc. which allows a user to login and edit that data?
I'm not looking for a complicated MVVM pattern example, it can be hard coded, it should just save the developer the time of creating all the CRUD code and forms and authorization necessary for users to edit the data. The developer could define 10 database tables, run the code generation, and then be pretty much 80% finished with any simple database application he wanted to make.
All of that would be generic code so I would think some framework like this would exist or someone would be working on some open source project like this already.
Does anyone know of a framework or tool like this?
It's not Silverlight, but ASP.NET Dynamic Data sounds like it would do what you're asking. It provides a web-based front end for editing database tables.
I've used it for a small project and you can literally have it up and running with CRUD functionality within an hour.
maybe you should take a look at the Sculpture project. There might be something you are looking for.
Since you cannot have direct connection to a database server with Silverlight, you should look at a .NET data access framework using the regular .NET Framework thru a Web Service.