<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://code.msdn.microsoft.com/rss.xsl"?><rss version="2.0"><channel><title>multitierlinqtosql Forum Rss Feed</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/List.aspx</link><description>multitierlinqtosql Forum Rss Description</description><item><title>NEW POST: Adding DbTransaction functionality to the Generic Controller</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=1169</link><description>&lt;div class="wikidoc"&gt;
Adding DbTransaction functionality to the Generic Controller&lt;br /&gt; &lt;br /&gt;Hi,&lt;br /&gt; &lt;br /&gt;I really like this approach and so want to ensure that i am not messing up my architecture. In some cases i cannot realize the transactional aspect only with a single execution of DataContext.SubmitChanges() at the end, because the order - execution of the added commands is not guaranteed afaik. Let's assume I have PersonDetails and Person with a FK constraint, so PersonDetails has to be deleted first.&lt;br /&gt; &lt;br /&gt;So in most cases this throws an FK exception:&lt;br /&gt; &lt;br /&gt;EntityDetailsTable.DeleteAllOnSubmit(delDetails);&lt;br /&gt;EntityTable.DeleteAllOnSubmit(delEntities);&lt;br /&gt;SubmitChanges();&lt;br /&gt; &lt;br /&gt;Would work but if i am very unlucky the entity survives without details if the db server crashes at the right second&lt;br /&gt; &lt;br /&gt;EntityDetailsTable.DeleteAllOnSubmit(delDetails);&lt;br /&gt;SubmitChanges();&lt;br /&gt;EntityTable.DeleteAllOnSubmit(delEntities);&lt;br /&gt;SubmitChanges();&lt;br /&gt; &lt;br /&gt;Solution which came into my mind: Manually implemented transaction with DbTransaction Class.&lt;br /&gt; &lt;br /&gt;I would create the instance of DbTransaction in my GenericController like:&lt;br /&gt; &lt;br /&gt;protected DbTransaction trans = null;&lt;br /&gt; &lt;br /&gt;try&lt;br /&gt;            {&lt;br /&gt;                // Open the connection&lt;br /&gt;                DataContext.Connection.Open();&lt;br /&gt;                trans = DataContext.Connection.BeginTransaction();&lt;br /&gt;                DataContext.Transaction = trans;&lt;br /&gt; &lt;br /&gt;                EntityDetailsTable.DeleteAllOnSubmit(delDetails);&lt;br /&gt;				EntityTable.DeleteAllOnSubmit(delEntities);&lt;br /&gt; &lt;br /&gt;                trans.Commit();&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine(ex.Message);&lt;br /&gt;                // Rollback transaction&lt;br /&gt;                if (trans != null)&lt;br /&gt;                    trans.Rollback();&lt;br /&gt;            }&lt;br /&gt;            finally&lt;br /&gt;            {&lt;br /&gt; &lt;br /&gt;                // Close the connection&lt;br /&gt;                if (DataContext.Connection.State == ConnectionState.Open)&lt;br /&gt;                    DataContext.Connection.Close();&lt;br /&gt;            }&lt;br /&gt;			&lt;br /&gt;This code snippet compiles wihtout problems although the delete statements are not fired because we are dealing with multiple entities and therefore have to use TransactionScope:&lt;br /&gt; &lt;br /&gt;using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))&lt;br /&gt;            {&lt;br /&gt;                try&lt;br /&gt;                {&lt;br /&gt;				EntityDetailsTable.DeleteAllOnSubmit(delDetails);&lt;br /&gt;				SubmitChanges();&lt;br /&gt;				DataContext.ExecuteCommand(&amp;quot;DELETE * FROM blabla&amp;quot;); // raise exception&lt;br /&gt;				EntityTable.DeleteAllOnSubmit(delEntities);&lt;br /&gt;				SubmitChanges();&lt;br /&gt;                    &lt;br /&gt; &lt;br /&gt;                }&lt;br /&gt;                catch (Exception ex)&lt;br /&gt;                {&lt;br /&gt;                    //throw new Exception(ex.Message);&lt;br /&gt;                    //ThrowHelper.ThrowBackupException(&amp;quot;Finalizing occurs an error. The transcation will be rollback.&amp;quot;);&lt;br /&gt;                    //return false;&lt;br /&gt;                    logger.LogError(ex);&lt;br /&gt;                }&lt;br /&gt; &lt;br /&gt;                scope.Complete();&lt;br /&gt;            }&lt;br /&gt; &lt;br /&gt;In this case the details got deleted cause obviousle transactionscope can only handle on Submit changes.&lt;br /&gt; &lt;br /&gt;So i am very thankful for any help!&lt;br /&gt;
&lt;/div&gt;</description><author>wuz</author><pubDate>Tue, 13 Jan 2009 22:11:41 GMT</pubDate><guid isPermaLink="false">NEW POST: Adding DbTransaction functionality to the Generic Controller 20090113P</guid></item><item><title>NEW POST: What is the fastest way to get a scalar value back</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=976</link><description>&lt;div class="wikidoc"&gt;
What is the fastest way to get a scalar value&lt;br /&gt; &lt;br /&gt;I am wondering about the most efficient way to get back 1 non key value from an entity. &lt;br /&gt; &lt;br /&gt;Things I would consider are &lt;br /&gt;1.	pre compiled queries &lt;br /&gt;2.	Object Tracking&lt;br /&gt;3.	Creating a “new” entity.&lt;br /&gt; &lt;br /&gt;See this interesting article from Sidar&lt;br /&gt; &lt;br /&gt;http://www.sidarok.com/web/blog/content/2008/05/02/10-tips-to-improve-your-linq-to-sql-application-performance.html&lt;br /&gt;
&lt;/div&gt;</description><author>tintin5</author><pubDate>Wed, 19 Nov 2008 19:27:19 GMT</pubDate><guid isPermaLink="false">NEW POST: What is the fastest way to get a scalar value back 20081119P</guid></item><item><title>NEW POST: How to use in NON ASP.NET code sections?</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=361</link><description>&lt;div class="wikidoc"&gt;
Hello all, this project has now moved to http://www.codeplex.com/MultiTierLinqToSql&lt;br /&gt;The most recent version also has the method to discard the datacontext requested in this thread&lt;br /&gt;
&lt;/div&gt;</description><author>rbates</author><pubDate>Wed, 05 Nov 2008 14:18:33 GMT</pubDate><guid isPermaLink="false">NEW POST: How to use in NON ASP.NET code sections? 20081105P</guid></item><item><title>NEW POST: Problem on Update</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=379</link><description>&lt;div class="wikidoc"&gt;
Hello rabindradalai, I can't reproduce this error but I think it is because the movId column is the primary key of the table. You might be better fetching the entity first with GetEntity(id) and then updating it. &lt;br /&gt;If you have any other questions then post them on the CodePlex site:&lt;br /&gt;http://www.codeplex.com/MultiTierLinqToSql&lt;br /&gt;
&lt;/div&gt;</description><author>rbates</author><pubDate>Wed, 05 Nov 2008 14:15:26 GMT</pubDate><guid isPermaLink="false">NEW POST: Problem on Update 20081105P</guid></item><item><title>NEW POST: Problem on Update</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=379</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;&lt;div class="quote"&gt;
 &lt;br /&gt;RTPeat wrote:&lt;br /&gt;Found the bug, problem solved.&lt;br /&gt; &lt;br /&gt;
&lt;/div&gt; &lt;br /&gt;Hi RTPeat, what was the problem you are facing..and how did you solved it. is it similar to the one that i am facing below:&lt;br /&gt; &lt;br /&gt;Hi,&lt;br /&gt; &lt;br /&gt;I have cerated my own DBMovieController&amp;lt;TEntity&amp;gt; which is inherited from GenericController&amp;lt;TEntity, DBMovieDataContext&amp;gt; where TEntity : class&lt;br /&gt; &lt;br /&gt;when i try to call the following code &lt;br /&gt; &lt;br /&gt;tblMain manupdate = new tblMain();&lt;br /&gt;manupdate.movID = &amp;quot;3&amp;quot;;&lt;br /&gt;manupdate.movTitle = &amp;quot;FANNA !&amp;quot;;&lt;br /&gt;manupdate.movRunTime = 30;&lt;br /&gt;DBMovieController&amp;lt;tblMain&amp;gt;.Update(manupdate);&lt;br /&gt; &lt;br /&gt;it throws following error, but my movID is not a identity column in tblMain.&lt;br /&gt; &lt;br /&gt;Value of member 'movID' of an object of type 'tblMain' changed.&lt;br /&gt;A member defining the identity of the object cannot be changed.&lt;br /&gt;Consider adding a new object with new identity and deleting the existing one instead&lt;br /&gt; &lt;br /&gt;please give some inputs..&lt;br /&gt;
&lt;/div&gt;</description><author>rabindradalai</author><pubDate>Mon, 03 Nov 2008 11:12:19 GMT</pubDate><guid isPermaLink="false">NEW POST: Problem on Update 20081103A</guid></item><item><title>NEW POST: Problem on Update</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=379</link><description>&lt;div class="wikidoc"&gt;
Hi,&lt;br /&gt; &lt;br /&gt;I have cerated my own DBMovieController&amp;lt;TEntity&amp;gt; which is inherited from  GenericController&amp;lt;TEntity, DBMovieDataContext&amp;gt; where TEntity : class&lt;br /&gt; &lt;br /&gt;when i try to call the following code &lt;br /&gt; &lt;br /&gt; tblMain manupdate = new tblMain();&lt;br /&gt;        manupdate.movID = &amp;quot;3&amp;quot;;&lt;br /&gt;        manupdate.movTitle = &amp;quot;FANNA !&amp;quot;;&lt;br /&gt;        manupdate.movRunTime = 30;&lt;br /&gt;        DBMovieController&amp;lt;tblMain&amp;gt;.Update(manupdate);&lt;br /&gt; &lt;br /&gt;it throws following error, but my movID is not a identity column in tblMain.&lt;br /&gt; &lt;br /&gt;Value of member 'movID' of an object of type 'tblMain' changed.&lt;br /&gt;A member defining the identity of the object cannot be changed.&lt;br /&gt;Consider adding a new object with new identity and deleting the existing one instead&lt;br /&gt; &lt;br /&gt;please give some inputs..&lt;br /&gt;
&lt;/div&gt;</description><author>rabindradalai</author><pubDate>Mon, 03 Nov 2008 11:01:22 GMT</pubDate><guid isPermaLink="false">NEW POST: Problem on Update 20081103A</guid></item><item><title>NEW POST: Question - Error handling</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=322</link><description>&lt;div class="wikidoc"&gt;
Hello beljakm, to answer your question, the way you should handle this is in the OnUpdated/OnInserted event of your GenericObjectDataSource using code like the following:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
 protected void ProductDataSource_Updated(object sender, ObjectDataSourceStatusEventArgs e)
    {
        if (e.Exception != null)
        {
            //litError is a literal control I am using to display the error to the user
            litError.Text = e.Exception.Message;
            e.ExceptionHandled = true;
        }
    }
&lt;/pre&gt; &lt;br /&gt;Basically you check if an exception has occurred, do something with it, probably show the details to the user, and then tell the GenericObjectDatasource that you've handled it. To use this you'll need to get version 1.7 as there was a bug in the way this worked in previous versions.&lt;br /&gt;Note that I'm moving the code over to CodePlex, so you can now use svn to get the latest source, should be easier for everyone!&lt;br /&gt;Rupert&lt;br /&gt;
&lt;/div&gt;</description><author>rbates</author><pubDate>Thu, 30 Oct 2008 19:52:27 GMT</pubDate><guid isPermaLink="false">NEW POST: Question - Error handling 20081030P</guid></item><item><title>NEW POST: Question - Error handling</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=322</link><description>&lt;div class="wikidoc"&gt;
Hello,&lt;br /&gt; &lt;br /&gt;I have probably posted my question in the wrong discussion group earlier, so I am re-posting it.  &lt;br /&gt; &lt;br /&gt;rbates - the solution is very elegant, and its evolving.   However, here is a question:&lt;br /&gt; &lt;br /&gt;Where and how do you handle events, e.g. OnLastNameChanged() in your person class? If I extend Person class, as shown below, and an exception is thrown, I keep getting error in GenericObjectDataSourceView because PropertyDescriptor, SetValue property does not handle ArgumentException. Should I somehow handle this in PersonController? Any easy way to get around this?  This based on ScottGu's blog.&lt;br /&gt; &lt;br /&gt;namespace DataLayer&lt;br /&gt;{&lt;br /&gt;public partial class Person&lt;br /&gt;{ &lt;br /&gt;partial void OnLastNameChanged()&lt;br /&gt;{&lt;br /&gt;if (this.LastName==&amp;quot;&amp;quot;)&lt;br /&gt;throw new Exception(&amp;quot;Error: Last Name cannot be empty.&amp;quot;);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;P.S. &lt;br /&gt;The example below is trivial, and it is only for illustrative purposes. I would like to know what is the best way to handle DataContext events.&lt;br /&gt;
&lt;/div&gt;</description><author>beljakm</author><pubDate>Tue, 21 Oct 2008 18:14:43 GMT</pubDate><guid isPermaLink="false">NEW POST: Question - Error handling 20081021P</guid></item><item><title>NEW POST: Using LINQ to sql in three tier architecture with ObjectDataSource and BusinessObject</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=591</link><description>&lt;div class="wikidoc"&gt;
I have been rapidly getting into generics, and learning its powers.  Examples shown here are great.  However, here is a question:&lt;br /&gt; &lt;br /&gt;Where and how do you handle events, e.g. OnLastNameChanged() in your person class?  If I extend Person class, as shown below, and an exception is thrown, I keep getting error in GenericObjectDataSourceView because PropertyDescriptor, SetValue property does not handle ArgumentException.  Should I somehow handle this in PersonController? Any easy way to get around this?&lt;br /&gt; &lt;br /&gt;namespace DataLayer&lt;br /&gt;{&lt;br /&gt;    public partial class Person&lt;br /&gt;    {       &lt;br /&gt;        partial void OnLastNameChanged()&lt;br /&gt;        {&lt;br /&gt;            if (this.LastName==&amp;quot;&amp;quot;)&lt;br /&gt;               throw new Exception(&amp;quot;Error: Last Name cannot be empty.&amp;quot;);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;P.S. &lt;br /&gt;The example below is trivial, and it is only for illustrative purposes.  I would like to know what is the best way to handle DataContext events.&lt;br /&gt;
&lt;/div&gt;</description><author>beljakm</author><pubDate>Sat, 18 Oct 2008 18:26:46 GMT</pubDate><guid isPermaLink="false">NEW POST: Using LINQ to sql in three tier architecture with ObjectDataSource and BusinessObject 20081018P</guid></item><item><title>NEW POST: Sorting with IEnumerable data not supported</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=749</link><description>&lt;div class="wikidoc"&gt;
&lt;div class="quote"&gt;
 &lt;br /&gt;Tess wrote:&lt;br /&gt;Hello. Great discussion. I ran into a problem with the sample project, however, which I don't see discussed elsewhere. I get the error &amp;quot;data source 'ProductDataSource' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.&amp;quot;&lt;br /&gt;Did anyone else see that? Fix that?&lt;br /&gt;Cheers,&lt;br /&gt;Tess&lt;br /&gt; &lt;br /&gt;
&lt;/div&gt; &lt;br /&gt;Hi Tess, the fix is to add the attribute SortParameterName=&amp;quot;sortExpression&amp;quot; into the ProductDataSource. I don't know how that got broken in the example project but I'll update it now, thanks for pointing it out.&lt;br /&gt;
&lt;/div&gt;</description><author>rbates</author><pubDate>Sat, 11 Oct 2008 13:46:53 GMT</pubDate><guid isPermaLink="false">NEW POST: Sorting with IEnumerable data not supported 20081011P</guid></item><item><title>NEW POST: Sorting with IEnumerable data not supported</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=749</link><description>&lt;div class="wikidoc"&gt;
Hello. Great discussion. I ran into a problem with the sample project, however, which I don't see discussed elsewhere. I get the error &amp;quot;data source 'ProductDataSource' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.&amp;quot;&lt;br /&gt;Did anyone else see that? Fix that?&lt;br /&gt;Cheers,&lt;br /&gt;Tess&lt;br /&gt;
&lt;/div&gt;</description><author>Tess</author><pubDate>Fri, 26 Sep 2008 20:18:19 GMT</pubDate><guid isPermaLink="false">NEW POST: Sorting with IEnumerable data not supported 20080926P</guid></item><item><title>NEW POST: EntitySet property or seperate controller</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=729</link><description>&lt;div class="wikidoc"&gt;
I'd definitely go for option 1. Not that there's anything particularly wrong with option 2 it's just more code for no gain. Also if the child table only makes sense in the context of the parent table then it's better practice to deal primarily with that table.&lt;br /&gt;
&lt;/div&gt;</description><author>rbates</author><pubDate>Sun, 21 Sep 2008 22:35:04 GMT</pubDate><guid isPermaLink="false">NEW POST: EntitySet property or seperate controller 20080921P</guid></item><item><title>NEW POST: Question - Error handling</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=322</link><description>&lt;div class="wikidoc"&gt;
Hi rbates, I was thinking the same thing by implementing a static close method or alike dispose of the datacontext by request.&lt;br /&gt; &lt;br /&gt;It is a little more verbose, but if I could overcome my other requirement using the static implementation then I would go with the static approach, however I cannot think of another way of doing this, unless you have some suggestions?  I need to be able to use a controller(s) dynamically to insert and update (using reflection and configuration), i'm using your GenericController as the data layer component of a larger generic application i am working on.&lt;br /&gt; &lt;br /&gt;The idea is to feed my generic business components with a controller (based on the GenericController class and an interface I have implemented) and using reflection I create/insert/update entities regardless of the type.  I haven't been able to figure out a way to do this with the static approach, any ideas?&lt;br /&gt; &lt;br /&gt;I've attached the interface I have implemented, which basically just enforces additional overloads to create and insert entity objects without having to know the type at compile time.  I couldn't think of any other way to go about doing this without knowing the types at compile time.  I've implemented CreateEntity methods in the GenericController class to create, insert and return the correct entity, including non-generic methods.&lt;br /&gt; &lt;br /&gt;I would appreciate your thoughts on what I have done and if you think I should/could have done things different/better.&lt;br /&gt; &lt;br /&gt;Cheer&lt;br /&gt;TC&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;    public interface IController&lt;br /&gt;    {&lt;br /&gt;        void Insert(object entity);&lt;br /&gt;        ...&lt;br /&gt;   &lt;br /&gt;        object CreateObject();&lt;br /&gt;        ...&lt;br /&gt; &lt;br /&gt;        void SubmitChanges();&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    public class GenericController&amp;lt;TEntity, TDataContext&amp;gt; : IController, IDisposable ...&lt;br /&gt;    {&lt;br /&gt;        ...&lt;br /&gt;        ...&lt;br /&gt;        ...&lt;br /&gt; &lt;br /&gt;        public void Insert(object entity)&lt;br /&gt;        {&lt;br /&gt;            Insert(entity as TEntity)&lt;br /&gt;        }&lt;br /&gt; &lt;br /&gt;        public TEntity CreateEntity()&lt;br /&gt;        {&lt;br /&gt;            TEntity entity = new TEntity();&lt;br /&gt;            Insert(entity)&lt;br /&gt; &lt;br /&gt;            return entity;&lt;br /&gt;        }        &lt;br /&gt; &lt;br /&gt;        public object CreateObject() // Same as CreateEntity but couldn't overload because of existing definition&lt;br /&gt;        {&lt;br /&gt;            return CreateEntity() as object;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>tc</author><pubDate>Thu, 18 Sep 2008 08:05:30 GMT</pubDate><guid isPermaLink="false">NEW POST: Question - Error handling 20080918A</guid></item><item><title>NEW POST: How to use in NON ASP.NET code sections?</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=361</link><description>&lt;div class="wikidoc"&gt;
Hi, &lt;br /&gt; &lt;br /&gt;Thanks for the framework - very helpful!&lt;br /&gt; &lt;br /&gt;It would be handy to be able to undo changes made to the datacontext in non-asp.net applications.  As far as I can see there is no way to discard changes made to tables in a datacontext without destroying it.  What about a method in the genericcontroller to destroy the datacontext, so then the next time a DataContext is called a new one is created?&lt;br /&gt; &lt;br /&gt;Thanks,&lt;br /&gt;David.&lt;br /&gt;
&lt;/div&gt;</description><author>DavidB</author><pubDate>Thu, 18 Sep 2008 04:46:07 GMT</pubDate><guid isPermaLink="false">NEW POST: How to use in NON ASP.NET code sections? 20080918A</guid></item><item><title>NEW POST: Question - Error handling</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=322</link><description>&lt;div class="wikidoc"&gt;
Hi tc, I think the approach you suggest is fine, it makes the code a bit more verbose but that's just a cosmetic thing really. Another thought I had would be to allow the calling code to tell the controller to dispose of the datacontext when it needed to, this would be useful in a number of other scenarios as well so I'll probably add it in at some point.&lt;br /&gt;
&lt;/div&gt;</description><author>rbates</author><pubDate>Wed, 17 Sep 2008 18:31:51 GMT</pubDate><guid isPermaLink="false">NEW POST: Question - Error handling 20080917P</guid></item><item><title>NEW POST: EntitySet property or seperate controller</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=729</link><description>&lt;div class="wikidoc"&gt;
Hi,&lt;br /&gt; &lt;br /&gt;I'm torn on which approach I should use to select/insert/update the collection side of one-to-many relationships, should I have a single controller and use the EntitySet property to insert/update or should i define a seperate controller and use this to select/insert/update?&lt;br /&gt; &lt;br /&gt;eg.&lt;br /&gt; &lt;br /&gt;Option 1 - single controller using EntitySet property&lt;br /&gt; &lt;br /&gt;Parent p = new Parent();&lt;br /&gt;p.Children.Add(new Child());&lt;br /&gt;p.Children.Add(new Child());&lt;br /&gt;ParentController.Insert(p);&lt;br /&gt; &lt;br /&gt;Option 2 - one controller per table&lt;br /&gt; &lt;br /&gt;Parent p = new Parent();&lt;br /&gt;ParentController.Insert(p);&lt;br /&gt; &lt;br /&gt;Child c = new Child();&lt;br /&gt;c.ParentID = p.Parent.ID;&lt;br /&gt;ChildController.Insert(c)&lt;br /&gt; &lt;br /&gt;c = new Child();&lt;br /&gt;c.ParentID = p.Parent.ID;&lt;br /&gt;ChildController.Insert(c)&lt;br /&gt; &lt;br /&gt;I'm currently leaning towards option 1 as it just seems to work better, but in doing so I want to ensure that i'm not violating any architecural best practices.&lt;br /&gt; &lt;br /&gt;Any thoughts?&lt;br /&gt; &lt;br /&gt;Thanks &lt;br /&gt;TC&lt;br /&gt;
&lt;/div&gt;</description><author>tc</author><pubDate>Wed, 17 Sep 2008 16:49:36 GMT</pubDate><guid isPermaLink="false">NEW POST: EntitySet property or seperate controller 20080917P</guid></item><item><title>NEW POST: Question - Error handling</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=322</link><description>&lt;div class="wikidoc"&gt;
Hi,&lt;br /&gt; &lt;br /&gt;I'm having similar issues when dealing with exceptions, i've been finding that pending inserts/updates stay cached until they are submitted but i don't want them to because after the exceptions are handled the generally the actions are retried and I get into more trouble because of duplicate inserts and updates.&lt;br /&gt; &lt;br /&gt;I am using this purely in a winforms application so I think the underlying issue for me comes down to the lifespan of the datacontext, the way I am working around this at the moment is I have converted the GenericController from static to instance methods and properties so the datacontext has the same lifespan as the controller (as suggested in another post by rbates).&lt;br /&gt; &lt;br /&gt;I've found this to work OK so far, is there anything I should be concerned about with this approach?&lt;br /&gt; &lt;br /&gt;Cheers&lt;br /&gt;TC &lt;br /&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>tc</author><pubDate>Wed, 17 Sep 2008 16:22:37 GMT</pubDate><guid isPermaLink="false">NEW POST: Question - Error handling 20080917P</guid></item><item><title>NEW POST: Using LINQ to sql in three tier architecture with ObjectDataSource and BusinessObject</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=591</link><description>&lt;div class="wikidoc"&gt;
Advice::&lt;br /&gt;http://blogs.msdn.com/mirceat/archive/2008/03/13/linq-framework-design-guidelines.aspx&lt;br /&gt;
&lt;/div&gt;</description><author>SkyTracer</author><pubDate>Tue, 16 Sep 2008 13:18:52 GMT</pubDate><guid isPermaLink="false">NEW POST: Using LINQ to sql in three tier architecture with ObjectDataSource and BusinessObject 20080916P</guid></item><item><title>NEW POST: Using LINQ to sql in three tier architecture with ObjectDataSource and BusinessObject</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=591</link><description>&lt;div class="wikidoc"&gt;
Hi wuz,&lt;br /&gt; &lt;br /&gt;Just wondering if you could give me a little more detail on your implementation as I need to do a very similar thing to model some one-to-many relationships.&lt;br /&gt; &lt;br /&gt;Your advice would be much appreciated...&lt;br /&gt; &lt;br /&gt;Thanks&lt;br /&gt;TC&lt;br /&gt;
&lt;/div&gt;</description><author>tc</author><pubDate>Fri, 12 Sep 2008 02:56:33 GMT</pubDate><guid isPermaLink="false">NEW POST: Using LINQ to sql in three tier architecture with ObjectDataSource and BusinessObject 20080912A</guid></item><item><title>NEW POST: How to use in NON ASP.NET code sections?</title><link>http://code.msdn.microsoft.com/multitierlinqtosql/Thread/View.aspx?ThreadId=361</link><description>&lt;div class="wikidoc"&gt;
Hi rbates,&lt;br /&gt; &lt;br /&gt;Thanks for the feedback, I guess my concern is that this application could have a lifetime from hours to days to possibly even weeks and i'm not sure that keeping the data context alive for this amount of time is a wise approach?&lt;br /&gt; &lt;br /&gt;I'll try a few things and see how I go and post my finding here, I have a few options to try out so i don't think i will be short of ideas.&lt;br /&gt; &lt;br /&gt;Thanks&lt;br /&gt;TC&lt;br /&gt;
&lt;/div&gt;</description><author>tc</author><pubDate>Fri, 12 Sep 2008 02:45:12 GMT</pubDate><guid isPermaLink="false">NEW POST: How to use in NON ASP.NET code sections? 20080912A</guid></item></channel></rss>