Picking an ORM tool - So many choices, and so little time - database

After much reading, playing and fiddling, I am still not sure what ORM tool is the one i should be using above others.I am usign the Dotnet stack.
I have looked at:
Entity framework
LLBLgen Pro
NHibernate
Currenlty I am rather impressed with LLBLGen Pro.
I have also read about Castle's active record, sub sonic and Linq to SQL.
Why should i use one over the other and what are the pitfalls of using this one over that one?
How should i try and make the informed desicion.
I am concerened about some large gotcha that i might not see at this stage that will only come to life far into the development cycle and then have cause major hassles.
Thanks for all the help.

I have used both NHibernate and Entity Framework and both are great. If you like a more drag-and-drop approach, entity framework is the best choice and maybe the easiest to get started with. If you need a ORM for a commercial product maybe it's easier to sell EF (because Microsoft is behind it). At least that is my experience. But, I'm using HNibernate at my current project (at a customer) and we are very pleased with it. It has a bit of a learning curve, but once you get the hang of it it's pretty productive to use. The only drawback is the XML hacking you have to do. If you have the possibility to use EF 4 I think that would be my recommendation. If not, go for NHibernate.

Related

What is a good approach for migrating from LINQ to SQL to DocumentDB?

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.

How can I develop a database for users to access via a browser

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...

Develop a line of business application in silverlight 4

Currently as my job profile i am more working on asp .net application but i also wanted to have my hands on silverlight application. so, i just decided to build one silverlight 4 application in my spare time and on weekends.
We are having a team of around 4 people. We also tried for commercial application but as we can only develop it in our available time we can not commit on timeline as well as we people are new to SL, so first we need to learn concept and implement it. (Though we know the concept of binding, commanding,templates etc.)
Now i just thought to work on project like creating a social networking site in SL 4
having facilities like forum, blogs, calander, task, dashboard etc.
We want to use features like .Net RIA Service, Entity Framework, MVVM pattern, SL 4.
Objective here is to learn new concepts as well as to get some good project experince in silverlight.
Now,
what you people suggest is it a good idea ?
If yes then the project selected is correct or you suggest some other project ?
Any pattern or technology related suggestions ?
This is quite a vague set of questions but I'll attempt to give my 2 pennies worth of advice.
As a learning project this is as good an idea as any to get going with. As a commercial idea it probably isn't such a good one due to there not being any niche in your product. It has all already been done, and been done successfully by the likes of Facebook and Twitter. Developing any kind of social media site is incredibly difficult as the market is already fairly saturated. As I said though, as a learning project it's quite nice as you can just borrow concepts and ideas from other sites and you can concentrate on you main goals of gaining knowledge in the various technologies.
Whatever you decide to do I'd say split the project up into much smaller components rather than having the end goal in sight. Try to take more of an agile approach by setting yourself 2-3 week targets. It should help keep the momentum going. My experience is that learning projects tend to die a death as people get bored of the concept and lose motivation to do it. By keeping the tasks small you get to see small results often. This should help keep you motivated as you move from requirement to requirement.
Personally I think setting up personal projects and goals like this are a great way of learning new technologies - good for you!! :-)
From a tooling perspective it sounds like SL4 is an ideal route to follow. This is highly likely to be released in early 2010 and has some awesome new features compared to SL3. Would also recommend using VS2010 and WCF RIA Service too.
From a code sharing POV have you considered hosting your project on Codeplex? This will give you a hosted TFS server to manage your source code in a distributed way. This is bound to save you some big bucks.
As far as document management is concerned Google Docs are certainly worth a look (as is Google Sites as a really easy to set up (albeit simple) project management portal).
Finally, I can't recommend learning SketchFlow highly enough. As a prototyping tool for silverlight it is really, really cool. Take a look at the PDC video for a great kick start on this.
Good luck :-)

Interface Architecture for Silverlight App

I'm getting ready to develop my first Silverlight app. It is going to be primarily used by my church for data input but also will need to generate at least one report, ideally in Excel but XML/XSLT is not outside the realm...
It will be Internet facing and will talk to a SQL Server 2008 db for which I will be creating a web service hosted at the ISP (db is also hosted at the ISP). The clients will be a mix of Windows and Mac.
My question specifically relates to the interface architecture. I know MVVM is big for this right now and I'm comfortable with that. I want to get this up fairly quickly (ie- next 3-4 weeks). I've also seen mention of Prism (Composite Application Guidance) and Caliburn. What are anyone's thoughts on these two? The initial version of the app is not going to be huge so I don't imagine it would be overly difficult to refactor a framework into it at a later date.
You are right, if it's your first development on SL, adding the complexity of MVVM won't help you much.
I think a good approach could be to go for something simple (e.g.: the good old Document/View could be just a good start http://msdn.microsoft.com/en-us/library/4x1xy43a(VS.80).aspx, or just breaking in standard layers, UI / BS / DL).
After that development you will have learnt a lot of good stuff, and then you will be able to throw your app and start new bigger challenges using more advanced architectures (about MVVM, a very good web cast: http://blog.lab49.com/archives/2650 it's WPF based most of the concepts can be ported to SL).
Good luck and enjoy for SL development.
Cheers
Braulio
Start with something you are very comfortable with especially if you need to get this up quickly. Follow good coding standards and should not be a problem to refactor later into other frameworks if you get a bigger team.
This is a useful pdf.
I haven't read it in detail yet myself, but this article looks rather useful:
RIA Architecture with Silverlight in mind

MVP/MVC vs traditional n-tier approach for winform apps

We have a large suite of apps, most are C# 1.1, but at least 10 major ones are in VB6. We are undertaking a project to bring up the VB6 apps to .NET 3.5.
All the c# 1.1 apps are written using a traditional n-Tier approach. There isn't really any architecture/separation to the UI layer. Most of the code just responds to events and goes from there. I would say that from the point of maintainability, it's been pretty good and it's easy to follow code and come up to speed on new apps.
As we are porting VB6 apps, the initial thinking was that we should stick to the existing pattern (e.g. n-Tier).
I am wondering, whether it's worth it breaking the pattern and doing VB6 apps using teh MVP/MVC pattern? Are MVC/MVP winform apps really easier to maintain? I worked on a MVC-based project and did not feel that it was easier to maintain at all, but that's just one project.
What are some of the experiences and advice out there?
Dude, if something works for you, you guys are comfortable with it, and your team is up to specs with it. Why do you need to change?
MVC/MVP sounds good... Then why am I still working on n-Tier myself?
I think before you commit resources to actual development on this new way of programming... You should consider if it works for YOUR team.
If you are porting the VB6 apps vs. a full rewrite, I'd suggest to focus on your Pri 1 goal - to get asap to the .Net world. Just doing this would have quite a lot of benefits for your org.
Once you are there, you can evaluate whether it's benefitial to you to invest into rearchitecting these apps.
If you are doing full rewrite, I'd say take the plunge and go for MVP/MVVM patterned WPF apps. WPF willl give you nicer visuals. The MVP/MVVM pattern will give you unit testability for all layers, including the visual. I also assume that these apps are related, so chances are you might be able to actually reuse your models and views. (though, I might be wrong here)
It moves a thin layer of code you still probably have on the UI. I say thin, because from your description you probably have plenty of code elsewhere.
What this gives you is the ability to unit test that thin layer of code.
Update 1: I don't recommend to re architect while doing the upgrade, the extra effort is best expend on getting automated tests (unit/integration/system) - since you will have to be testing the upgrade works anyway. Once you have the tests in place, you can make gradual changes to the application with the comfort of having tests to back the changes.
MVC in particular does not exclude n-Tier architecture.
We also have ASP.NET 1.1 business application, and I find it a real nightmare to maintain. When event handlers do whatever they like, maybe tweak other controls, maybe call something in business logic, maybe talk directly to the database, it is only by chance that software works at all.
With MVC if used correctly you can see the way the data flows from the database to your UI and backwards. It makes it easier to track the errors if you got the unexpected behaviour.
At least, it is so with my own little project.
I'll make the point once again: whatever pattern you use, stick to the clear n-Tier architecture. 2-Tier or 3-Tier, just don't mess everything into a big interconnected ball.
"Change - that activity we engage in to give the allusion of progress." - Dilbert
Seriously though, just getting your development environment and deployment platforms up to .NET 3.51 is a big step in and of itself. I would recommend that things like security reviews and code walkthroughs should probably come before re-archecting the application.
MVC and MVVM are excellent paradimes, particulary in terms of testability. Don't forget about them, but perhaps you should consider a pilot project before full scale adoption?

Resources