<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Linq To Sql: POCO and Value Objects</title>
	<atom:link href="http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/feed/" rel="self" type="application/rss+xml" />
	<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/</link>
	<description></description>
	<lastBuildDate>Sat, 28 Jan 2012 14:35:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Patrik Löwendahl</title>
		<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/#comment-1381</link>
		<dc:creator><![CDATA[Patrik Löwendahl]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 22:42:58 +0000</pubDate>
		<guid isPermaLink="false">http://rogeralsing.com/?p=699#comment-1381</guid>
		<description><![CDATA[S&gt;&gt;I explicitly said CQS style of DDD, so lets stick to that context.

So you did, my mistake. 

&gt;&gt;Also depending on the style of CQS DDD you use, you might persist the commands instead of the actual entities.

This sounds more like Martin Fowlers &quot;Event Source pattern&quot; then CQS.

&gt;&gt;In such case it is very easy to map projections against a single table or view.
Also in that case there will be a lot of transformation logic in the message to the query store. I don&#039;t necessary agree with Greg that this is optimal, you put a lot of responsibility on the database schema and on the message transport, not to mention all the transaction work that need to go on to make the data integrity stick.]]></description>
		<content:encoded><![CDATA[<p>S&gt;&gt;I explicitly said CQS style of DDD, so lets stick to that context.</p>
<p>So you did, my mistake. </p>
<p>&gt;&gt;Also depending on the style of CQS DDD you use, you might persist the commands instead of the actual entities.</p>
<p>This sounds more like Martin Fowlers &#8220;Event Source pattern&#8221; then CQS.</p>
<p>&gt;&gt;In such case it is very easy to map projections against a single table or view.<br />
Also in that case there will be a lot of transformation logic in the message to the query store. I don&#8217;t necessary agree with Greg that this is optimal, you put a lot of responsibility on the database schema and on the message transport, not to mention all the transaction work that need to go on to make the data integrity stick.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Alsing</title>
		<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/#comment-1380</link>
		<dc:creator><![CDATA[Roger Alsing]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 20:30:52 +0000</pubDate>
		<guid isPermaLink="false">http://rogeralsing.com/?p=699#comment-1380</guid>
		<description><![CDATA[@Patrik.

1) I should have said view specific _data_ model,
which is what Greg Young is suggesting, the query data source holds denormalized data.

In such case it is very easy to map projections against a single table or view.

So in the example you give, there would either be a denormalized table holding the product origins, or possibly a view that aggregates that for you.

If you are going for that approach or if you simply want to expose a projection as objects for whatever reason, e.g. if you want to migrate data and you want to clean it up a bit.. this works very well..

2) 
There are plenty of ways to do changetracking, and you know that too since you were building a change tracking system yourself just a few weeks ago.

And in the case of cancel order, in the most naive case I guess that would simply set a cancelled flag to true on an order.. so there is not much to &quot;figure out&quot; there.. just perform the action and commit.

Also depending on the style of CQS DDD you use, you might persist the commands instead of the actual entities.

This way you get a complete audit log where you can replay every action ever processed in your system.
And thus rebuild the system state for any given time.

A specific entitys state would then be the sum of all the commands that ever affected it.

(Optimizations for not having to replay every command is out of this scope)

&quot;&quot;
This has however nothing to do with the original thoughs that Meijer had on CQS.
&quot;&quot;

I explicitly said CQS style of DDD, so lets stick to that context.]]></description>
		<content:encoded><![CDATA[<p>@Patrik.</p>
<p>1) I should have said view specific _data_ model,<br />
which is what Greg Young is suggesting, the query data source holds denormalized data.</p>
<p>In such case it is very easy to map projections against a single table or view.</p>
<p>So in the example you give, there would either be a denormalized table holding the product origins, or possibly a view that aggregates that for you.</p>
<p>If you are going for that approach or if you simply want to expose a projection as objects for whatever reason, e.g. if you want to migrate data and you want to clean it up a bit.. this works very well..</p>
<p>2)<br />
There are plenty of ways to do changetracking, and you know that too since you were building a change tracking system yourself just a few weeks ago.</p>
<p>And in the case of cancel order, in the most naive case I guess that would simply set a cancelled flag to true on an order.. so there is not much to &#8220;figure out&#8221; there.. just perform the action and commit.</p>
<p>Also depending on the style of CQS DDD you use, you might persist the commands instead of the actual entities.</p>
<p>This way you get a complete audit log where you can replay every action ever processed in your system.<br />
And thus rebuild the system state for any given time.</p>
<p>A specific entitys state would then be the sum of all the commands that ever affected it.</p>
<p>(Optimizations for not having to replay every command is out of this scope)</p>
<p>&#8220;&#8221;<br />
This has however nothing to do with the original thoughs that Meijer had on CQS.<br />
&#8220;&#8221;</p>
<p>I explicitly said CQS style of DDD, so lets stick to that context.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Alsing</title>
		<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/#comment-1379</link>
		<dc:creator><![CDATA[Roger Alsing]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 20:04:39 +0000</pubDate>
		<guid isPermaLink="false">http://rogeralsing.com/?p=699#comment-1379</guid>
		<description><![CDATA[Ohh. I honestly did not know that..
I have never seen any LTS sample use anything else but EntitySet and EntityRef.]]></description>
		<content:encoded><![CDATA[<p>Ohh. I honestly did not know that..<br />
I have never seen any LTS sample use anything else but EntitySet and EntityRef.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrik Löwendahl</title>
		<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/#comment-1377</link>
		<dc:creator><![CDATA[Patrik Löwendahl]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 19:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://rogeralsing.com/?p=699#comment-1377</guid>
		<description><![CDATA[1) You wouldn’t need to if you go for a CQS model with view specific data
Ehm, yes you do. If you don&#039;t creat views in the database you&#039;d have to ask the database for interesting views with some kind of query.

Take this example, 

You have orders, theese orders reserver product quantities from warehouses. If you want a view that shows where the orders got their quantities from, you&#039;ll need a query (assuming that information is in the same database ofcourse). LTS will have extreme problems with this when there is intelligent views you want.

2)
You missunderstand me. 

There is nothing in Meijers CQS that states that the query and command can&#039;t work on the same domain model. What it does state is that operations on the domain should not query and do commands at the same time.

I&#039;m also not saying that you send the model to the command and make it figure out what changes. I&#039;m saying that the command can /use/ the model. 

Take for instance the command &quot;cancel order&quot;. When doing so there is several things that might have to happen, you do this with a command on a model. Thus, state in the model will have changed and need to be persisted. 

This is where change tracking will help you persist the state changes the command did on the model itself.

Though, Udi Dahan talks about CQS on a service level where have separate services for commands and queries (and separate database). 

This has however nothing to do with the original thoughs that Meijer had on CQS.]]></description>
		<content:encoded><![CDATA[<p>1) You wouldn’t need to if you go for a CQS model with view specific data<br />
Ehm, yes you do. If you don&#8217;t creat views in the database you&#8217;d have to ask the database for interesting views with some kind of query.</p>
<p>Take this example, </p>
<p>You have orders, theese orders reserver product quantities from warehouses. If you want a view that shows where the orders got their quantities from, you&#8217;ll need a query (assuming that information is in the same database ofcourse). LTS will have extreme problems with this when there is intelligent views you want.</p>
<p>2)<br />
You missunderstand me. </p>
<p>There is nothing in Meijers CQS that states that the query and command can&#8217;t work on the same domain model. What it does state is that operations on the domain should not query and do commands at the same time.</p>
<p>I&#8217;m also not saying that you send the model to the command and make it figure out what changes. I&#8217;m saying that the command can /use/ the model. </p>
<p>Take for instance the command &#8220;cancel order&#8221;. When doing so there is several things that might have to happen, you do this with a command on a model. Thus, state in the model will have changed and need to be persisted. </p>
<p>This is where change tracking will help you persist the state changes the command did on the model itself.</p>
<p>Though, Udi Dahan talks about CQS on a service level where have separate services for commands and queries (and separate database). </p>
<p>This has however nothing to do with the original thoughs that Meijer had on CQS.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven</title>
		<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/#comment-1376</link>
		<dc:creator><![CDATA[Steven]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 18:58:16 +0000</pubDate>
		<guid isPermaLink="false">http://rogeralsing.com/?p=699#comment-1376</guid>
		<description><![CDATA[LINQ to SQL actually does support POCO (just search google: http://www.google.nl/search?q=LINQ+to+SQL+POCO). Creating immutable value objects (and using those in LINQ queries) isn&#039;t possible though.]]></description>
		<content:encoded><![CDATA[<p>LINQ to SQL actually does support POCO (just search google: <a href="http://www.google.nl/search?q=LINQ+to+SQL+POCO" rel="nofollow">http://www.google.nl/search?q=LINQ+to+SQL+POCO</a>). Creating immutable value objects (and using those in LINQ queries) isn&#8217;t possible though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Alsing</title>
		<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/#comment-1375</link>
		<dc:creator><![CDATA[Roger Alsing]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 14:15:39 +0000</pubDate>
		<guid isPermaLink="false">http://rogeralsing.com/?p=699#comment-1375</guid>
		<description><![CDATA[1) You wouldn&#039;t need to if you go for a CQS model with view specific data.

In such case it would be more of a one table to one root object mapping.

2) No it doesnt say the models have to differ.
But if they don&#039;t then there is little reason to use CQS.
In such case you could just aswell fetch normal entities and commit the changes made to them.

Passing the same DTO&#039;s back and forth doesn&#039;t make it CQS.
A command should state what changes are supposed to be made.
Not just say &quot;Here is how the object looks now&quot;, because in that case, yes you would need to figure out what changed..
But that would be ill designed commands.

&quot;&quot;
If you try to do /intelligent/ work in a domain model. You will still need to figure out what has changed and what hasn’t and configure your command with that. This is a pain if you try to use LTS as the persisting party.
&quot;&quot;

Any work in the domain model would be done when the commands are beeing processed.
the commands would be filled from the presentation model and no ORM would be involved at all there.

And just to be clear. Im really really not promoting LTS as a competent mapper.
I&#039;m simply saying that if you need view specific transformations, this is a very RAD approach.
Using RAD at the query layer won&#039;t hurt the rest of the application.]]></description>
		<content:encoded><![CDATA[<p>1) You wouldn&#8217;t need to if you go for a CQS model with view specific data.</p>
<p>In such case it would be more of a one table to one root object mapping.</p>
<p>2) No it doesnt say the models have to differ.<br />
But if they don&#8217;t then there is little reason to use CQS.<br />
In such case you could just aswell fetch normal entities and commit the changes made to them.</p>
<p>Passing the same DTO&#8217;s back and forth doesn&#8217;t make it CQS.<br />
A command should state what changes are supposed to be made.<br />
Not just say &#8220;Here is how the object looks now&#8221;, because in that case, yes you would need to figure out what changed..<br />
But that would be ill designed commands.</p>
<p>&#8220;&#8221;<br />
If you try to do /intelligent/ work in a domain model. You will still need to figure out what has changed and what hasn’t and configure your command with that. This is a pain if you try to use LTS as the persisting party.<br />
&#8220;&#8221;</p>
<p>Any work in the domain model would be done when the commands are beeing processed.<br />
the commands would be filled from the presentation model and no ORM would be involved at all there.</p>
<p>And just to be clear. Im really really not promoting LTS as a competent mapper.<br />
I&#8217;m simply saying that if you need view specific transformations, this is a very RAD approach.<br />
Using RAD at the query layer won&#8217;t hurt the rest of the application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrik Löwendahl</title>
		<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/#comment-1374</link>
		<dc:creator><![CDATA[Patrik Löwendahl]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 14:00:20 +0000</pubDate>
		<guid isPermaLink="false">http://rogeralsing.com/?p=699#comment-1374</guid>
		<description><![CDATA[Well, 

A couple of things. 

1) Querying like this is a PAIN. LTS can&#039;t query graphs, it just can&#039;t. Single entities without inheritence, yeah sure. Anything beyond that prepare for a bumpy ride.

2) You can definatly use CQS in the way you explain it. Though, CQS does not say that the models have to differ. It just says that the commands and queries in the domain should be separate. 

If you are in a web environment or a request / response in any other scenario. You might fill your commands with data from what you get in your request and insert / update it (this is usually forms over data). 

If you try to do /intelligent/ work in a domain model. You will still need to figure out what has changed and what hasn&#039;t and configure your command with that. This is a pain if you try to use LTS as the persisting party.]]></description>
		<content:encoded><![CDATA[<p>Well, </p>
<p>A couple of things. </p>
<p>1) Querying like this is a PAIN. LTS can&#8217;t query graphs, it just can&#8217;t. Single entities without inheritence, yeah sure. Anything beyond that prepare for a bumpy ride.</p>
<p>2) You can definatly use CQS in the way you explain it. Though, CQS does not say that the models have to differ. It just says that the commands and queries in the domain should be separate. </p>
<p>If you are in a web environment or a request / response in any other scenario. You might fill your commands with data from what you get in your request and insert / update it (this is usually forms over data). </p>
<p>If you try to do /intelligent/ work in a domain model. You will still need to figure out what has changed and what hasn&#8217;t and configure your command with that. This is a pain if you try to use LTS as the persisting party.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Alsing</title>
		<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/#comment-1373</link>
		<dc:creator><![CDATA[Roger Alsing]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 13:38:58 +0000</pubDate>
		<guid isPermaLink="false">http://rogeralsing.com/?p=699#comment-1373</guid>
		<description><![CDATA[Using CQS you would not insert or update using this model, only query it.
CQS promotes view specific projections, so RAD works fine here.

And regarding graphs, it depends if your aggregates have direct or indirect associations.

And tracking changes would in the CQS case be handled elsewhere, the commands would carry the changes only, and thus you wouldn&#039;t need to figure out _what_ changed.. the commands tells you that..]]></description>
		<content:encoded><![CDATA[<p>Using CQS you would not insert or update using this model, only query it.<br />
CQS promotes view specific projections, so RAD works fine here.</p>
<p>And regarding graphs, it depends if your aggregates have direct or indirect associations.</p>
<p>And tracking changes would in the CQS case be handled elsewhere, the commands would carry the changes only, and thus you wouldn&#8217;t need to figure out _what_ changed.. the commands tells you that..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrik Löwendahl</title>
		<link>http://rogeralsing.com/2009/11/21/linq-to-sql-poco-and-value-objects/#comment-1372</link>
		<dc:creator><![CDATA[Patrik Löwendahl]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 13:18:44 +0000</pubDate>
		<guid isPermaLink="false">http://rogeralsing.com/?p=699#comment-1372</guid>
		<description><![CDATA[It might /seem/ like a good idea but it will hurt as hell if you build anything that Linq To Sql initially couldn&#039;t handle. 

In my current project they went down this route and have had to abandon it due to Linq To Sql nastiness, we have now migrated over to NHibernate.

Querying works ok, about 50% of what needed to be done could be done with Linq To Sql. Any other case there had to be very ugly linq queries or stored procedures. 

Inserting and updating graphs? Forget about it, you&#039;ll be traversing the graph and manually try to figure out what has changed. 

So, for RAD and forms over data it looks like a good idea. But for anything with a little business logic and at least some intelligent models, you&#039;ll be out of luck sooner then you can install an other ORM.]]></description>
		<content:encoded><![CDATA[<p>It might /seem/ like a good idea but it will hurt as hell if you build anything that Linq To Sql initially couldn&#8217;t handle. </p>
<p>In my current project they went down this route and have had to abandon it due to Linq To Sql nastiness, we have now migrated over to NHibernate.</p>
<p>Querying works ok, about 50% of what needed to be done could be done with Linq To Sql. Any other case there had to be very ugly linq queries or stored procedures. </p>
<p>Inserting and updating graphs? Forget about it, you&#8217;ll be traversing the graph and manually try to figure out what has changed. </p>
<p>So, for RAD and forms over data it looks like a good idea. But for anything with a little business logic and at least some intelligent models, you&#8217;ll be out of luck sooner then you can install an other ORM.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

