<?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/"
		>
<channel>
	<title>Comments on: Screencast: Working with Views in LightSpeed</title>
	<atom:link href="http://www.mindscapehq.com/blog/index.php/2009/01/27/screencast-working-with-views-in-lightspeed/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mindscapehq.com/blog/index.php/2009/01/27/screencast-working-with-views-in-lightspeed/</link>
	<description>The official blog of Mindscape</description>
	<lastBuildDate>Wed, 08 Feb 2012 09:29:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Ivan Towlson</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/01/27/screencast-working-with-views-in-lightspeed/comment-page-1/#comment-28723</link>
		<dc:creator>Ivan Towlson</dc:creator>
		<pubDate>Wed, 28 Jan 2009 20:44:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=463#comment-28723</guid>
		<description>Hello Nefajciar,

If you change a SkuCode entity and save changes, it will get saved back to the SkuCodes &quot;table&quot; -- which is actually a view.  Of course this will only work if it is an updateable view.  And you are correct that this could cause concurrency issues if you load both a SkuCode and a Sku, and save one of them back.  LightSpeed doesn&#039;t know that SkuCodes and Skus are related.  So the scenario shown in the video is a bit artificial -- in reality you would probably not have read-write entities which &quot;overlap&quot; in this way, but we wanted to keep the model simple for the video.

Notice, by the way, that this issue only arises because Sku and SkuCode are different *types*.  Skus loaded through different views -- e.g. CheapItems and ExpensiveItems -- are identified and participate in normal entity concurrency behaviour.  So there are actually two different kinds of view support in LightSpeed -- views as a way of creating new entity types (SkuCodes), and views as a way of querying existing entity types (CheapItems).

Regarding the differences between making a view for CheapItems and making a stored procedure for CheapItems: one obvious difference is that a stored procedure can take parameters, e.g. GetCheapItems(decimal maxPrice).  Also, a stored procedure can contain a lot more business logic than a view.  But a stored procedure is not queryable: for example you can combine a view with a WHERE clause but you cannot do the same with a stored procedure.  (This is why the designer-generated wrappers for stored procedures return ILists and those for views return IQueryables.)  You can still use sproc return sets with LINQ but this will use LINQ to Objects and be processed client-side.

The video shows both LINQ-based and Find-based techniques for using views.  So using LINQ you can go uow.CheapItems.Where(sku =&gt; sku.ProductId == 1) and using Find you can go uow.Find&lt;Sku&gt;(new Query(Entity.Attribute(&quot;ProductId&quot; == 1) { ViewName = &quot;CheapItems&quot; }).  Either is good; it&#039;s a matter of taste (and which version of the .NET Framework you&#039;re targeting) which you use.

I&#039;ll let JD field the questions about vocal technique since he&#039;s the star of the show...</description>
		<content:encoded><![CDATA[<p>Hello Nefajciar,</p>
<p>If you change a SkuCode entity and save changes, it will get saved back to the SkuCodes &#8220;table&#8221; &#8212; which is actually a view.  Of course this will only work if it is an updateable view.  And you are correct that this could cause concurrency issues if you load both a SkuCode and a Sku, and save one of them back.  LightSpeed doesn&#8217;t know that SkuCodes and Skus are related.  So the scenario shown in the video is a bit artificial &#8212; in reality you would probably not have read-write entities which &#8220;overlap&#8221; in this way, but we wanted to keep the model simple for the video.</p>
<p>Notice, by the way, that this issue only arises because Sku and SkuCode are different *types*.  Skus loaded through different views &#8212; e.g. CheapItems and ExpensiveItems &#8212; are identified and participate in normal entity concurrency behaviour.  So there are actually two different kinds of view support in LightSpeed &#8212; views as a way of creating new entity types (SkuCodes), and views as a way of querying existing entity types (CheapItems).</p>
<p>Regarding the differences between making a view for CheapItems and making a stored procedure for CheapItems: one obvious difference is that a stored procedure can take parameters, e.g. GetCheapItems(decimal maxPrice).  Also, a stored procedure can contain a lot more business logic than a view.  But a stored procedure is not queryable: for example you can combine a view with a WHERE clause but you cannot do the same with a stored procedure.  (This is why the designer-generated wrappers for stored procedures return ILists and those for views return IQueryables.)  You can still use sproc return sets with LINQ but this will use LINQ to Objects and be processed client-side.</p>
<p>The video shows both LINQ-based and Find-based techniques for using views.  So using LINQ you can go uow.CheapItems.Where(sku => sku.ProductId == 1) and using Find you can go uow.Find<sku>(new Query(Entity.Attribute(&#8220;ProductId&#8221; == 1) { ViewName = &#8220;CheapItems&#8221; }).  Either is good; it&#8217;s a matter of taste (and which version of the .NET Framework you&#8217;re targeting) which you use.</p>
<p>I&#8217;ll let JD field the questions about vocal technique since he&#8217;s the star of the show&#8230;</sku></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nefajciar</title>
		<link>http://www.mindscapehq.com/blog/index.php/2009/01/27/screencast-working-with-views-in-lightspeed/comment-page-1/#comment-28709</link>
		<dc:creator>nefajciar</dc:creator>
		<pubDate>Wed, 28 Jan 2009 12:04:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=463#comment-28709</guid>
		<description>Great!

Keep them comming, more complicated video sessions welcomed, or is everything so purely easy with LightSpeed? ;)

1. &quot;obviously we can/cannot update the sku table&quot;  at 6:50 timeframe.

So Can we or can&#039;t we? Sometimes the voice is really hard to comprehend for non-english speakers, different voice would be welcomed (any lady out there?;-)

2. I&#039;ve got quick question at the ending:
   When I&#039;ve changed just the SkuCode type will Lightspeed save changes upon UOW commit to both SKU entity and SkuCodes View or just the View? What about concurency problems (someone updated Code in SKU table and another one on SkuCode entity)?

3. Watching last video and this one I have one really newbie question:

What is the difference between using View CheapItems and making a Stored procedure to return them.

As I understand it, using View I&#039;ll automatically get
collection of strongly typed LS entities and which is LINQified (IQueryable) so it is very easy to work with, but views are mostly static.

Whereas using Stored Procedure I&#039;ll just get an IList collection (and I can use parameters) but I have to call AsQueryable() extension method on it to use it with LINQ.

4. in the video, couldn&#039;t you just use LINQ to return entity with &quot;ProductID&quot; == 1? Or is it faster to work with IList and you&#039;ve choosed not to have overhead of IQueryable interface?

Thank you</description>
		<content:encoded><![CDATA[<p>Great!</p>
<p>Keep them comming, more complicated video sessions welcomed, or is everything so purely easy with LightSpeed? ;)</p>
<p>1. &#8220;obviously we can/cannot update the sku table&#8221;  at 6:50 timeframe.</p>
<p>So Can we or can&#8217;t we? Sometimes the voice is really hard to comprehend for non-english speakers, different voice would be welcomed (any lady out there?;-)</p>
<p>2. I&#8217;ve got quick question at the ending:<br />
   When I&#8217;ve changed just the SkuCode type will Lightspeed save changes upon UOW commit to both SKU entity and SkuCodes View or just the View? What about concurency problems (someone updated Code in SKU table and another one on SkuCode entity)?</p>
<p>3. Watching last video and this one I have one really newbie question:</p>
<p>What is the difference between using View CheapItems and making a Stored procedure to return them.</p>
<p>As I understand it, using View I&#8217;ll automatically get<br />
collection of strongly typed LS entities and which is LINQified (IQueryable) so it is very easy to work with, but views are mostly static.</p>
<p>Whereas using Stored Procedure I&#8217;ll just get an IList collection (and I can use parameters) but I have to call AsQueryable() extension method on it to use it with LINQ.</p>
<p>4. in the video, couldn&#8217;t you just use LINQ to return entity with &#8220;ProductID&#8221; == 1? Or is it faster to work with IList and you&#8217;ve choosed not to have overhead of IQueryable interface?</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic (Requested URI is rejected)
Database Caching 4/11 queries in 0.020 seconds using disk: basic
Content Delivery Network via cdn.mindscapehq.com

Served from: www.mindscapehq.com @ 2012-02-08 16:28:02 -->
