Last post Sep 22, 2020 09:42 PM by PatriceSc
Sep 21, 2020 12:19 PM|davilanka|LINK
I am using Linq in an asp.Net webforms project. I use the following sample code while saving an object in the BusinessLayer layer to the database.
ProjectDataContext ctx = ContextFactory.CreateDataContext ();
Coming to my question, can I run a method by triggering it automatically after every "ctx.SubmitChanges ()" run.
I would appreciate it if you could help with this.
Thanks in advance
Sep 21, 2020 12:36 PM|mgebhard|LINK
You can create an extension method that contains logic and call the extension method rather an SubmitChanges().
Sep 22, 2020 02:11 AM|yij sun|LINK
Accroding to your description,I'm guessing that you want to save data to database.What the method do you need to run?Do you need to save opeartion?
You could call .InsertOnSubmit as many times as you like, and .SubmitChanges will push all those INSERT's to the DB for you.
More details,you could refer to below article:
Sep 22, 2020 09:42 PM|PatriceSc|LINK
Or maybe using inheritance? This is Linq to SQL or some other Linq provider?