Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linq + repository classes

Status
Not open for further replies.

Gruuka

Programmer
Aug 27, 2006
24
NL
Greetings,

In a current vs solution I have 2 projects, 1 holds the linq datacontext classes and another holds the business model.

Inside the business model I created a class which inherits from my datacontext like so;
Public Class <snip>DataModel
Inherits <snip>DataContext

In which I added a method which will trigger when ever a certain object is inserted.

Private Sub InsertToestel(ByVal instance As Entities.Toestel)

In this case when I call RinkelBVDataModel.Toestellen.Insertonsubmit(newToestel)
The aforementioned method is called instead of the default method generated by linq.

I made a testproject around this but whenever I add another method which adds a new object to the database I recieve a sqltimeout exception.

Example code;
Private Sub InsertToestel(ByVal instance As Entities.Toestel)
Dim ToestellenRepository As Model.Repositories.ToestellenRepository = New Model.Repositories.ToestellenRepository
ToestellenRepository.Add(instance)
End Sub

ToestellenRepository.Add would insert several other items besides instance to the database.

Does anyone know any specific fix for this? Or a better method to deal with business logic in the linq datacontext?

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top