No suitable method found to override


When I added the InsertAuditRecordToDatabase override to the DataContext partial class that is generated by Linq to SQL (Right click on LINQ designer surface and choose View Code), I get a "No suitable method to override" error. If I create a separate partial class file, everything goes well. The code inside each file is exactly identical. I speculate it must have to do with the order that L2S is including/combining these partial class files. Does anyone have any ideas? I would like to use the partial class files that LINQ attaches to the DBML to keep everything together.


dodone wrote Apr 21, 2010 at 10:33 AM

Once you make a change to the dbml file, the changes you made to the [mydbml].Designer.cs will be lost; so to use a standalone file to put those changes, such as:MyDataContext.cs:
partial class MyDataContext : Doddle.Linq.Audit.LinqToSql.AuditableDataContext
//Changes to the DataContext should be put here, also note that once you make a change in the dbml file, to remove the base class [System.Data.Linq.DataContext] in the [mydbml].Designer.cs
//public partial class JNTestDataContext: System.Data.Linq.DataContext