Hi,
Linq2SQL gives you a lot of freedom doing such things.
Since it the generated classes are partial you can easily extend them.
I assume your Linq2SQL class has the name WebContent and the namespace is ManniAT.
Change those 2 names to your need.
To go on:
a.) in Project Explorer on the folder DataThings right click - choose add class - name it "DataHelpers"
--the name does not really matter
b.) remove all content from the file
c.) add the following code (check namespace and class name!!!)
Snippet created with CBEnhancer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace ManniAT.DataThings {
public partial class WebContent {
partial void OnCreated() {
DateCreated =
DateTime.Now;
EndDate =
DateTime.Now.AddDays(30);
}
}
}
With this your should be fine!
Regards
Manfred