For argument's sake, how will i convince someone that Linq2Sql is far better than Data Access Application Block in an Asp.Net MVC project?
How will i convince someone that Linq2Sql is far开发者_如何转开发 better than Data Access Application Block in an Asp.Net MVC project?
Seriously, if you don't know why it's better, why do you think you're qualified to convince someone else?
I don't mean to disparage you but most people arguing something would do so because they believe it to be true (presumably because of some reason or reasons), something that seems lacking in this case.
I mean I could try and convince you that C# is a better language than F# but I'd be wasting my time. My knowledge of both is near-non-existent.
I'll take a stab at it:
One reason is that you will get strong typing of your data. Switching from looping over dr["column"] with various casts to pulling back a strongly typed object is a breath of fresh air. Catching data access errors at compile time is wonderful.
Certainly you can accomplish the same with an object layer over your sql but you are basically going to end up with a shadow of what linq2sql gives you out of the box.
Also, think of the time you will save by letting the linq expression trees generate the sql vs coding it all by hand. the initial pass won't be bad but refactoring a database is a pain once you have to modify every query accessing it.
Combine that with defining your canonical data relationships in one place and its no wonder so many people switched from direct sql access to linq2sql.
edit:
In my experience resistance to trying new things comes from the fear of leaving something you understand to something you don't. My guess is you would get a better reception from your co-workers if you set up a small demo that walked through a simple scenario. Build it in front of them and explain every step. Show the generated sql at the end and let them examine it. They will have much better information to go on for your shared decision.
"Better" depends on your situation. Are you sure it is really "better"? Maybe the person you are trying to convince is right and you are wrong?
What is your exact situation?
If it indeed is far better for your project then it should be easy for you to make a clear list of the pros and cons of each approach as it applies to your situation.
Then set up a meeting with all the involved stakeholders and present your case.
So one person who does not know why want help to convince another person who does not know why. Both persons know what they want without having a clue why.
For me this is a nobrainer. Stick with what's allready going untill anything better is proven. And to prove something is better you'll have to understand what you got and what you compare with.
精彩评论