<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.allpaul.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Programming</title><subtitle type="html" /><id>http://www.allpaul.com/blogs/programming/atom.aspx</id><link rel="alternate" type="text/html" href="http://www.allpaul.com/blogs/programming/default.aspx" /><link rel="self" type="application/atom+xml" href="http://www.allpaul.com/blogs/programming/atom.aspx" /><generator uri="http://communityserver.org" version="4.0.30417.1769">Community Server</generator><updated>2003-04-16T14:55:00Z</updated><entry><title>MVC 3.0 RC?</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2010/11/06/mvc-3-0-rc.aspx" /><id>/blogs/programming/archive/2010/11/06/mvc-3-0-rc.aspx</id><published>2010-11-06T07:23:00Z</published><updated>2010-11-06T07:23:00Z</updated><content type="html">&lt;p&gt;I attended&amp;nbsp;DevConnections last week in Las Vegas.&amp;nbsp;&amp;nbsp;During all of the Microsoft Day sessions the MS employees were really&amp;nbsp;talking up the new features of MVC 3.0&amp;nbsp;especially the new Razor syntax. Plenty of demos were shown using Razor and in all of them the presenter was whipping together DemoWare quickly using Razor intellisense. However, if you download the&amp;nbsp;latest available beta today you&amp;#39;ll notice the intellisense does not work for Razor.&amp;nbsp;I cornered one of the MS employees after a talk and asked him when we would see Razor intellisense, perhaps another beta or a release candidate and he said...VERY SOON.&amp;nbsp; I kept pressing and he acknowledged perhaps as soon as next week. &lt;/p&gt;
&lt;p&gt;Then on my way home from the airport I was listening to the Hanselminutes podcast titled, &lt;span style="color:#000000;"&gt;&lt;a href="http://www.hanselminutes.com/default.aspx?showID=257" title="&amp;lt;ASP.NET MVC 3 RC and NuGet Package Management with Phil Haack/&amp;gt;" class="null"&gt;&amp;lt;ASP.NET MVC 3 RC and NuGet Package Management with Phil Haack/&amp;gt;&lt;/a&gt;&lt;/span&gt;. In that podcast Phil Haack says that they just released a RC of MVC 3.0, but nothing was available when I searched. If you read the podcast comments, another listener makes note of the fact that the RC is not available to which Scott Hanselman replies that he released the podcast a week too early.&lt;/p&gt;
&lt;p&gt;So, we should be seeing a RC of MVC 3.0 complete with Razor intellisense this week...Yippee!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=1824" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author><category term="ASP.NET MVC" scheme="http://www.allpaul.com/blogs/programming/archive/tags/ASP.NET+MVC/default.aspx" /></entry><entry><title>Upgrading an Entity Framework version 1 model to version 4</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2010/04/27/upgrading-an-entity-framework-version-1-model-to-version-4.aspx" /><id>/blogs/programming/archive/2010/04/27/upgrading-an-entity-framework-version-1-model-to-version-4.aspx</id><published>2010-04-27T04:53:00Z</published><updated>2010-04-27T04:53:00Z</updated><content type="html">&lt;p&gt;I recently decided to upgrade a client&amp;#39;s application from&amp;nbsp;Entity Framework version 1 to&amp;nbsp;version 4 (MS skipped a few numbers to make the EF version match the .NET version). The main reason for the upgrade was the client requested a feature to clone an entity.&amp;nbsp; There is no really easy way to clone&amp;nbsp;a complex&amp;nbsp;entity object.&amp;nbsp; The object in this case, Project, has many associations and those associations also have many associations. Here is&amp;nbsp;an image of the Project object in the designer.&lt;/p&gt;
&lt;p&gt;&lt;img height="483" width="248" src="http://www.allpaul.com/archive/images/programming/ef_v1_project.jpg" alt="Project object" /&gt;&lt;/p&gt;
&lt;p&gt;And, because I don&amp;#39;t want to just copy the associations to the new Project, but instead, create new objects that represent the associations and add those to the new Project while maintaining the original object values I needed to jump through a bunch of hoops.&lt;/p&gt;
&lt;p&gt;I was hoping that version 4&amp;#39;s inclusion of foreign keys in the generated model would help. By being able to set simple associations by simply setting the foreign key (ID) instead of getting the association object and adding the object to the parent.&amp;nbsp; The clone method (actually I am using a copy constructor) was already going to be quite long, so I was hoping this upgrade&amp;nbsp;would simplify things a bit.&lt;/p&gt;
&lt;p&gt;However, there is NO way to upgrade a model and have the designer automatically add the foreign keys.&amp;nbsp; I am sure I am not the only developer that is looking to upgrade existing code specifically to take advantage of the foreign key inclusion of EF 4.&amp;nbsp; Hopefully, with some help from the community or Microsoft this process can be easier in the future.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=903" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author></entry><entry><title>Entity Framework Stored Procedure Gotcha</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2009/06/10/entity-framework-stored-procedure-gotcha.aspx" /><id>/blogs/programming/archive/2009/06/10/entity-framework-stored-procedure-gotcha.aspx</id><published>2009-06-10T05:28:00Z</published><updated>2009-06-10T05:28:00Z</updated><content type="html">&lt;p&gt;I recently discovered and interesting tidbit about&amp;nbsp;stored procedures and their counterparts, function imports, in the entity framework (EF).&amp;nbsp; In the past I have used stored procedures in the EF when I need to do complex operations when adding new database records.&amp;nbsp;The one thing I never really paid attention to was the return type of the stored procedure.&amp;nbsp; I&amp;#39;ll generally&amp;nbsp;add a select * from the &amp;nbsp;corresponding table and return all the values of the newly added row.&amp;nbsp; Then in the EF model designer, I create a function import and set the return type to the type of object just added.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;I needed to return a scalar value (int) from a stored procedure and that&amp;#39;s where the gotcha comes in.&lt;/p&gt;
&lt;p&gt;It seems that the object context (OC) of an EF model doesn&amp;#39;t handle scalar return types.&amp;nbsp; The model designer allows you to create the function import and set the return type to a scalar value, however the model will not have any reference to the new method (via intellisense or at runtime).&lt;/p&gt;
&lt;p&gt;I found a few posts discussing the issue which seems to be fixed in the next version of the EF...Here are a few links&lt;/p&gt;
&lt;p&gt;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/4fae55c8-e103-46a8-b4c3-16077e912bf9"&gt;http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/4fae55c8-e103-46a8-b4c3-16077e912bf9&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions/"&gt;http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For now I am going to use the method in the first link.&amp;nbsp; I&amp;#39;ll create a function that encapsulate some database code and replace it later when the next version of the EF is out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=105" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author></entry><entry><title>Linq to entities "IN" query</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2008/09/15/linq-to-entities-quot-in-quot-query.aspx" /><id>/blogs/programming/archive/2008/09/15/linq-to-entities-quot-in-quot-query.aspx</id><published>2008-09-15T19:02:00Z</published><updated>2008-09-15T19:02:00Z</updated><content type="html">&lt;p&gt;Recently I was looking for a way to build the following SQL query&amp;nbsp;using the entity framework&amp;nbsp;&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; * &lt;span class="kwrd"&gt;FROM&lt;/span&gt; tbl_Registrations &lt;span class="kwrd"&gt;WHERE&lt;/span&gt; [ID] &lt;span class="kwrd"&gt;IN&lt;/span&gt; (1, 2, 3, 4, 5)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;But, turns out, that is not very easy. I thought of&amp;nbsp;three different approaches. To begin, I have a entity set Registrations of entities Registration.&amp;nbsp; These Registration entities have a property ID (int).&amp;nbsp; So I tried,&lt;/p&gt;
&lt;p&gt;1. Create an int array of the IDs and use the Intersect operator.&amp;nbsp; But, and there may be other reasons, the Intersect operator doesn&amp;#39;t accept Lambda expressions and without it the result would only be a list of ints, which I already had.&lt;/p&gt;
&lt;p&gt;2. Create an int array (Or List&amp;lt;int&amp;gt; or List&amp;lt;MyTypeWithIntProperty&amp;gt;) then join the array/list to my Registrations on the ID equal to the value in the array or list.&amp;nbsp; That doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;3. Use the Any operator with the same list/array from #2 with a Lambda expression.&amp;nbsp; That didn&amp;#39;t work either.&lt;/p&gt;
&lt;p&gt;Normally, I would then just hit the &lt;a href="http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=533&amp;amp;SiteID=1" class="null"&gt;newsgroup&lt;/a&gt;&amp;nbsp;and do a search, but I couldn&amp;#39;t search on the word IN and the word Any yielded more than 2000 results. After plugging through the almost random search results I finally came across another gem from Colin Meek. &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3044950&amp;amp;SiteID=1" class="null"&gt;The post&lt;/a&gt;&amp;nbsp;shows how to&amp;nbsp;achieve the desired results using a utility method to construct an expression of concatenated or statements.&amp;nbsp; So, my original query gets translated into&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (r.ID == 1 || r.ID == 2 || r.ID == 3 ...)&lt;/p&gt;
&lt;p&gt;To clarify HOW to implement his example, I did the following&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;int&lt;/span&gt;[] regIds = { 1, 2 };&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;var regs = (from r &lt;span class="kwrd"&gt;in&lt;/span&gt; se.Registrations&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;                        select r)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;           .Where(Extensions.&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;           BuildContainsExpression&amp;lt;Registration, &lt;span class="kwrd"&gt;int&lt;/span&gt;&amp;gt;(e =&amp;gt; e.ID, regIds));&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It should be noted that I have a class that contains all my extension and helper&amp;nbsp;methods called Extensions. Hopefully, by me writing about this it will help anyone looking for way to implement a &amp;quot;IN&amp;quot; query in Linq to entities.&lt;/p&gt;
&lt;p&gt;Good luck&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=55" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author></entry><entry><title>Deriving entities from a common interface</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2008/07/17/deriving-entities-from-a-common-interface.aspx" /><id>/blogs/programming/archive/2008/07/17/deriving-entities-from-a-common-interface.aspx</id><published>2008-07-17T13:10:00Z</published><updated>2008-07-17T13:10:00Z</updated><content type="html">&lt;p&gt;My current project has this concept of Activities.&amp;nbsp; Activities are defined as anything we want to track for a particular Company or Contact in the database.&amp;nbsp; A typical Activity may be&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ID = 21&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Description = Contacted office&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;IsCompanyOnly = false&lt;/p&gt;
&lt;p&gt;Now, as I said a company or contact may have these activities added so there are two tables in the database to facilitate this...tbl_Company_Activities and tbl_Contact_Activities...But for this discussion we don&amp;#39;t care about the tables as much as the Entities generated from them.&lt;/p&gt;
&lt;p&gt;Here is a diagram of how this is all shakes out (there is more than just this activity scenario going on in this diagram, so just focus on the Activity, CompanyActivity and ContactActivity entities):&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://www.allpaul.com/archive/images/programming/ActivityInterfaceExampleEntityDesignerDiagram_07182008.gif" style="border:0;" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;You see how they are exactly the same except their type CompanyActivity vs ContactActivity and the reference to either a Company or Contact?&amp;nbsp; All of the other fields are the same...And it just so happens that I need to get a list of all company and contact activities for a given company...I smelled an interface. I am going to extract the common fields Notes, ActivityDate, User, and ActivityCode and then add readonly (get properties) for the Type and RecordID (company or contact ID). here is that interface&amp;nbsp;&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; MyModel;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IActivityRecord&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; Notes&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        get;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        set;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    DateTime ActivityDate&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        get;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        set;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    DbUser User&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        get;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        set;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;    RecordInfoType RecordType&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        get;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; RecordId&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;        get;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    Activity ActivityCode&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;        get;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;        set;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;}&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Okay so now I need to&amp;nbsp;implement this interface.&amp;nbsp; Remember that my model already defined CompanyActivity and Contact as containing&amp;nbsp;&amp;nbsp;Notes, ActivityDate, User, and ActivityCode, so the only implementations that are up to me are the RecordType and RecordId.&amp;nbsp; It should be said at this point that RecordType is of type RecordInfoType which is an Enum that contains Company and Contact.&amp;nbsp; It should aslo be said that this next example code snippet builds upon my previous example &lt;a href="http://www.allpaul.com/blogs/programming/archive/2008/07/03/adding-computed-properties-to-entity-framework-entities.aspx" class="null"&gt;Adding computed properties to Entity Framework Entities&lt;/a&gt;&amp;nbsp;which shows you how to extend model-generated entities through partial classes.&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; MyModel&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ContactActivity : IActivityRecord&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; RecordInfoType RecordType&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;            get { &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; RecordInfoType.Contact; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;            &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; RecordId&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            get&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;            {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;                &lt;span class="kwrd"&gt;int&lt;/span&gt; ret = 0;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;this&lt;/span&gt;.ContactReference.IsLoaded)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                    ret = &lt;span class="kwrd"&gt;this&lt;/span&gt;.Contact.ID;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;                {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;using&lt;/span&gt; (MyEntities se = &lt;span class="kwrd"&gt;new&lt;/span&gt; MyEntities())&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                        ret = (from a &lt;span class="kwrd"&gt;in&lt;/span&gt; se.ContactActivities &lt;span class="kwrd"&gt;where&lt;/span&gt; a.ID == &lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;                                       this&lt;/span&gt;.ID select a.Contact.ID).FirstOrDefault();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; ret;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;            }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;That was the ContactActivity now here is the CompanyActivity:&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; MyModel&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CompanyActivity : IActivityRecord&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; RecordInfoType RecordType&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;            get { &lt;span class="kwrd"&gt;return&lt;/span&gt; RecordInfoType.Company; }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; RecordId&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;            get&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;                &lt;span class="kwrd"&gt;int&lt;/span&gt; ret = 0;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;this&lt;/span&gt;.CompanyReference.IsLoaded)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;                    ret = &lt;span class="kwrd"&gt;this&lt;/span&gt;.Company.ID;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;using&lt;/span&gt; (MyEntities se = &lt;span class="kwrd"&gt;new&lt;/span&gt; MyEntities())&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;                    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;                        ret = (from a &lt;span class="kwrd"&gt;in&lt;/span&gt; se.CompanyActivities &lt;/pre&gt;
&lt;pre&gt;                                    &lt;span class="kwrd"&gt;where&lt;/span&gt; a.ID == &lt;span class="kwrd"&gt;this&lt;/span&gt;.ID select a.Company.ID).FirstOrDefault();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; ret;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;            }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Cool, huh? Now I can bind a &lt;/p&gt;
&lt;p&gt;IEnumerable&amp;lt;IActivityRecord&amp;gt; &lt;/p&gt;
&lt;p&gt;to a GridView or work with it as a collection by retrieving it using linq...Oh, wait, I&amp;#39;ll still need to downcast, here is a method that takes a&amp;nbsp;Company object and returns a IList&amp;lt;IActivityRecord&amp;gt; of all the activities for the company and all its contacts:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; IList&amp;lt;IActivityRecord&amp;gt; getAllActivities(Company _company)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        IList&amp;lt;IActivityRecord&amp;gt; ret = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        &lt;span class="kwrd"&gt;using&lt;/span&gt; (MyEntities se = &lt;span class="kwrd"&gt;new&lt;/span&gt; MyEntities())&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;            IEnumerable&amp;lt;CompanyActivity&amp;gt; companyactivities =&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;                (from ca &lt;span class="kwrd"&gt;in&lt;/span&gt; se.CompanyActivities&lt;/pre&gt;
&lt;pre class="alt"&gt;                     .Include(&lt;span class="str"&gt;&amp;quot;Company&amp;quot;&lt;/span&gt;).Include(&lt;span class="str"&gt;&amp;quot;ActivityCode&amp;quot;&lt;/span&gt;).Include(&lt;span class="str"&gt;&amp;quot;User&amp;quot;&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;                 &lt;span class="kwrd"&gt;where&lt;/span&gt; ca.Company.ID == _company.ID&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;                 select ca);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;            ret = companyactivities.ToList()&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;                .ConvertAll(obj =&amp;gt; obj &lt;span class="kwrd"&gt;as&lt;/span&gt; IActivityRecord);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            IEnumerable&amp;lt;ContactActivity&amp;gt; contactactivities =&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;                (from ca &lt;span class="kwrd"&gt;in&lt;/span&gt; se.ContactActivities&lt;/pre&gt;
&lt;pre class="alt"&gt;                        .Include(&lt;span class="str"&gt;&amp;quot;Contact&amp;quot;&lt;/span&gt;).Include(&lt;span class="str"&gt;&amp;quot;ActivityCode&amp;quot;&lt;/span&gt;).Include(&lt;span class="str"&gt;&amp;quot;User&amp;quot;&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;                 &lt;span class="kwrd"&gt;where&lt;/span&gt; ca.Contact.Company.ID == _company.ID&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;                 select ca);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            ret.Union(contactactivities.ToList()&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                .ConvertAll(obj =&amp;gt; obj &lt;span class="kwrd"&gt;as&lt;/span&gt; IActivityRecord));&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; ret;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now there would need to be some logic on the consumer side to use the collection in other ways than just straightfroward databinding, but the RecordType and RecordID properties should allow the consumer to do what ever operations they need to.&lt;/p&gt;
&lt;p&gt;Good luck.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=50" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author></entry><entry><title>Adding computed properties to Entity Framework Entities</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2008/07/03/adding-computed-properties-to-entity-framework-entities.aspx" /><id>/blogs/programming/archive/2008/07/03/adding-computed-properties-to-entity-framework-entities.aspx</id><published>2008-07-03T00:18:00Z</published><updated>2008-07-03T00:18:00Z</updated><content type="html">&lt;p&gt;I have been working on a project using the Entity Framework.&amp;nbsp; One of the many cool features of the framework is it generates entity classes as partial classes so you, or in this case I, can extend an entity to include computed properties or methods.&lt;/p&gt;
&lt;p&gt;In this example I have a Contact entity.&amp;nbsp; It has many properties including, FirstName, MiddleInitial and LastName.&amp;nbsp; I&amp;#39;d like to be able to access a property called FullName so I don&amp;#39;t have to jump through all kinds of string null value checks and concatenation every time I need to display the contact&amp;#39;s name. So, here is my entity Contact from the Entity Designer&lt;/p&gt;
&lt;p&gt;&lt;img width="262" src="http://www.allpaul.com/archive/images/programming/ContactDesigner_07022008.jpg" alt="Contact Entity" height="423" /&gt;&lt;/p&gt;
&lt;p&gt;I can add to the partial class to include the property by creating a new class file (Contact.cs) and adding the correct namespace and including the partial keyword...Like this&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;span style="color:#0000ff;"&gt;namespace&lt;/span&gt; DBModel 
{ 

    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Contact 
    { 
        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; FullName 
        { 
            &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt; 
            { 
                &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; ret = &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Empty; 
                &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(FirstName)) 
                    ret += FirstName; 
                &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(MiddleInitial)) 
                    ret += &lt;span style="color:#800000;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + MiddleInitial; 
                &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(LastName)) 
                    ret += &lt;span style="color:#800000;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + LastName; 
                &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; ret; 
            } 
        } 
    } 

}&lt;/pre&gt;
&lt;p&gt;Now every time I need the contact&amp;#39;s name I can just do a &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myContact.FullName &lt;/p&gt;
&lt;p&gt;Sweet!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=49" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author></entry><entry><title>Entity Framework Designer Problems (VS-SP1 Beta release)</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2008/06/27/entity-framework-designer-problems-vs-sp1-beta-release.aspx" /><id>/blogs/programming/archive/2008/06/27/entity-framework-designer-problems-vs-sp1-beta-release.aspx</id><published>2008-06-27T10:18:00Z</published><updated>2008-06-27T10:18:00Z</updated><content type="html">&lt;p&gt;I have been developing a site using the latest release of the Entity Framework (EF).&amp;nbsp; The&amp;nbsp;EF is great because it allows me to create&amp;nbsp;business objects&amp;nbsp;that are not directly related to database tables without too much code.&amp;nbsp;&amp;nbsp;These new objects can be completely&amp;nbsp;different&amp;nbsp;in structure from the relational database that persists them.&amp;nbsp; For example...I have a Company object that has various attributes like Name, Phone, Fax, Web site and Addresses.&amp;nbsp; That&amp;nbsp;Addresses&amp;nbsp;is a collection of Address objects from a different&amp;nbsp;database table.&amp;nbsp; But, I needn&amp;#39;t worry about that&amp;nbsp;once&amp;nbsp;I design&amp;nbsp;how I want to present my objects in the Entity&amp;nbsp;Model Designer (More on that in a minute).&amp;nbsp; Back to that address thing.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The Company - Address relationship is more complex than CompanyID being a field in the Address table.&amp;nbsp; Instead, because Companies can share an Address (two companies are at the same location or have the same billing address and when it is updated for one company it will automatically update for the other) there is actually a many-to-many relationship here with a joining table in the database.&amp;nbsp; That relationship looks like this:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Company-&amp;gt;CompanyID, Name, ...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Address-&amp;gt;AddressID, Street1, Street2, City, ...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;CompanyAddress-&amp;gt;CompanyID, AddressID&lt;/p&gt;
&lt;p&gt;The one of the coolest things about the EF is once I set up that relationship in the designer (it does most of the work for you really), I can use my objects in a more traditional Conceptual and not Relational way.&lt;/p&gt;
&lt;p&gt;So, I can load my Company object and its Address objects using Linq&amp;nbsp; (overly simplified in this example)&lt;/p&gt;
&lt;pre style="font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;color:#000000;background-color:#eee;font-size:12px;border:1px dashed #999999;line-height:14px;padding:5px;overflow:auto;width:100%;"&gt;&lt;code&gt;        
        Company c = (from comp in context.Companies select comp).First();

        c.Addresses.Load();

        foreach (Address a in c.Addresses)
            Console.WriteLine(a.Street1);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cool! But, I have had some troubles with the designer that I believe are just due to its infancy as a product.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The designer creates a .edmx file that stores all of the relations, renamings and reorganization of your database - conceptual model structure.&amp;nbsp;It also creates a&amp;nbsp;ModelName.designer.cs file that includes the generated classes&amp;nbsp;for your new conceptual objects.&amp;nbsp; This .designer.cs file is created automatically when you build (or save, I think) the .edmx file.&amp;nbsp; However, on three occasions in two weeks this linking between the files has been lost.&amp;nbsp; I think it has to do with me restoring the files from backups or moving the directory where the .edmx file lives.&amp;nbsp; I plan to troubleshoot it more next time it happens.&lt;/li&gt;
&lt;li&gt;If you delete a conceptual object that is generated from a database table, there is no easy way to regenerate that class.&amp;nbsp; I would think right-clicking on the table name in the Model Browser would have some functionality like that, but it only allows an &amp;quot;Update from database&amp;quot; that doesn&amp;#39;t recreate the deleted object (and I think that is right because if it did and you really wanted it deleted, you&amp;#39;d be pissed every time it came back).&lt;/li&gt;
&lt;li&gt;If you forget to add a relation to your database before generating your Model, go back and add the relationship and then update from database to refresh the Model with the new information, it often becomes difficult to get the table mapping correct.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I think the tool is great in 80% of the scenarios I&amp;#39;ve thrown at it, but it needs a bit more work.&amp;nbsp; And, the development team should put together a Webcast to demonstrate how to use the designer for more difficult scenarios.&amp;nbsp; The only ones covered so far are very simple.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=48" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author><category term="Entity Framework" scheme="http://www.allpaul.com/blogs/programming/archive/tags/Entity+Framework/default.aspx" /></entry><entry><title>Article picked up by Microsoft's ASP.NET Web site</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2004/05/22/article-picked-up-by-microsoft-s-asp-net-web-site.aspx" /><id>/blogs/programming/archive/2004/05/22/article-picked-up-by-microsoft-s-asp-net-web-site.aspx</id><published>2004-05-22T13:57:00Z</published><updated>2004-05-22T13:57:00Z</updated><content type="html">&lt;p&gt;An article I wrote was picked up to run on one of Microsoft&amp;#39;s Developer Web sites--&lt;a href="http://www.asp.net/"&gt;www.asp.net&lt;/a&gt;. The article has since fallen off the front page. But, luckily, I have archived a screenshot for your enjoyment.&lt;br /&gt;&lt;br /&gt;In the ASP.NET Articles section, the one listed with a red &lt;span style="font-weight:bold;color:red;font-face:Verdana;"&gt;Today!&lt;/span&gt; is mine.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.allpaul.com/programming/asp.net/asp_net_03_04_2003.jpg" class="null"&gt;Click here for a screenshot&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=19" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author><category term="asp.net" scheme="http://www.allpaul.com/blogs/programming/archive/tags/asp.net/default.aspx" /><category term="article" scheme="http://www.allpaul.com/blogs/programming/archive/tags/article/default.aspx" /></entry><entry><title>School Projects</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2004/05/22/school-projects.aspx" /><id>/blogs/programming/archive/2004/05/22/school-projects.aspx</id><published>2004-05-22T13:53:00Z</published><updated>2004-05-22T13:53:00Z</updated><content type="html">&lt;p&gt;This is a collection of some (not all) of the programs I have written for school. There isn&amp;#39;t much in the way of descriptions yet, but I plan to add those later. Right now it&amp;#39;s just the raw files although they are commented.&lt;/p&gt;
&lt;p&gt;To view the files, click here&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=17" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author></entry><entry><title>Creating a Banner Ad System in ASP.NET</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2004/03/31/creating-a-banner-ad-system-in-asp-net.aspx" /><id>/blogs/programming/archive/2004/03/31/creating-a-banner-ad-system-in-asp-net.aspx</id><published>2004-03-31T13:13:00Z</published><updated>2004-03-31T13:13:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;In this article I build a banner ad display system using ASP.NET and SQL Server 2000. The system&amp;#39;s features include : &lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An html form-based administration for non-techies.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;An advertisement weighting option.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Click tracking.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://aspnet.4guysfromrolla.com/articles/033104-1.aspx" title="Go to article" class="null"&gt;Published on 4guysfromrolla.com March 31, 2004.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=14" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author><category term="banner ads" scheme="http://www.allpaul.com/blogs/programming/archive/tags/banner+ads/default.aspx" /><category term="asp.net" scheme="http://www.allpaul.com/blogs/programming/archive/tags/asp.net/default.aspx" /><category term="article" scheme="http://www.allpaul.com/blogs/programming/archive/tags/article/default.aspx" /></entry><entry><title>TV Audio Recorder</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2004/02/13/tv-audio-recorder.aspx" /><id>/blogs/programming/archive/2004/02/13/tv-audio-recorder.aspx</id><published>2004-02-13T14:46:00Z</published><updated>2004-02-13T14:46:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;This program began as a way to record the audio from 60 Minutes (I know I could do it from the radio too...In fact I have built a similar program for radio broadcasts like CarTalk) so I could copy it to my mp3 player and listen to it in the car on road trips.&lt;br /&gt;&lt;br /&gt;The program is a work in progress and I owe a lot to many others who have contributed (unknowingly) by posting various tutorials online.&lt;br /&gt;&lt;br /&gt;As the program lives today, you can control Sony Directv recievers only. I plan to make it possible to control RCA recievers, but the one I ordered for testing purposes has not arrived yet.&lt;br /&gt;&lt;br /&gt;Requires the .NET Framework.&lt;br /&gt;&lt;br /&gt;Read the help for more information.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.allpaul.com/programming/tv_audio_recorder/" class="null"&gt;Click here to download the program&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(ALL of this was before podcasts)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=15" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author></entry><entry><title>LAME mp3 converter front end</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2003/05/22/lame-mp3-converter-front-end.aspx" /><id>/blogs/programming/archive/2003/05/22/lame-mp3-converter-front-end.aspx</id><published>2003-05-22T13:51:00Z</published><updated>2003-05-22T13:51:00Z</updated><content type="html">&lt;p&gt;This application is a front end for LAME (a command line mp3 encoder). It allows users to browse to a .wav file, convert it, and optionally delete it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://beta.allpaul.com/programming/mp3converter.zip"&gt;mp3converter.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This program includes the source code written in Visual Basic.NET.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=16" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author><category term="audio recording" scheme="http://www.allpaul.com/blogs/programming/archive/tags/audio+recording/default.aspx" /></entry><entry><title>Building an Event Calendar Web Application</title><link rel="alternate" type="text/html" href="/blogs/programming/archive/2003/04/16/building-an-event-calendar-web-application.aspx" /><id>/blogs/programming/archive/2003/04/16/building-an-event-calendar-web-application.aspx</id><published>2003-04-16T13:55:00Z</published><updated>2003-04-16T13:55:00Z</updated><content type="html">&lt;p&gt;This article examines how to build an event calendar Web application that allows users to enter information for specific events into a database. This information is then displayed using the ASP.NET Calendar Web control so that users can see an overview of the month&amp;#39;s activities.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://aspnet.4guysfromrolla.com/articles/041603-1.aspx" title="Go to the article" class="null"&gt;Published on 4guysfromrolla.com April 16, 2003.&lt;/a&gt; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.allpaul.com/aggbug.aspx?PostID=18" width="1" height="1"&gt;</content><author><name>paully21</name><uri>http://www.allpaul.com/members/paully21/default.aspx</uri></author><category term="asp.net" scheme="http://www.allpaul.com/blogs/programming/archive/tags/asp.net/default.aspx" /><category term="article" scheme="http://www.allpaul.com/blogs/programming/archive/tags/article/default.aspx" /></entry></feed>
