tags:

views:

75

answers:

1

I'm using stored procedure in LINQ, i know it will generate a class T(procedure name + "Result") for me automatically to store the data.

If the name of stored procedure is spCampus, the generated class will be spCampusResult.

My Question:

when i'm using SP should i create custom class that replicate all the properties ( i'm refering to whatever the .dbml creates when you drag and drop the SP)

in my situation i will be using SP... is that fair to say i will be treating as a class object and pass around from model to controller and to view ?

or i will be better off creating a new custom business object contining all the props from .dbml ?

i havent get any clear cut answer

anybody?

A: 

In the designer you can shape the object any way you see fit. You can change the names of the properties you can change the name of the object returned from the sproc if you want to. It is also my understanding that you can change the protection levels on the properties as well. This to me means that you can use the LINQ2SQL generated objects as your DTO's or you business objects because you have the power to shape them as you see fit in the designer and since they are partial classes you can extend their behavior without touching the generated class. Hope this helps.

Michael Mann
Michael: thanks for your reply.let say i created a seprate class and that class is a partial class to my linq2sql generated objects but how would i be using properties in my partial class? i'm kinda lost here, it would be nice if you can just show me few lines of code.thank you so much again.