<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eric Fickes &#187; C#</title>
	<atom:link href="http://ericfickes.com/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://ericfickes.com</link>
	<description>Internets, Databases, Skateboards, Ice Hockeys, and Family</description>
	<lastBuildDate>Thu, 22 Jul 2010 22:45:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>DataBind a List of custom classes to an ASP:ListBox control</title>
		<link>http://ericfickes.com/2010/04/databind-a-list-of-custom-classes-to-an-asplistbox-control/</link>
		<comments>http://ericfickes.com/2010/04/databind-a-list-of-custom-classes-to-an-asplistbox-control/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 20:09:16 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[.NET framework]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[auto-implemented]]></category>
		<category><![CDATA[auto-implemented-properties]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[custom class]]></category>
		<category><![CDATA[DataBind]]></category>
		<category><![CDATA[DataSource]]></category>
		<category><![CDATA[properties]]></category>
		<category><![CDATA[VO]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1415</guid>
		<description><![CDATA[Recently I was scratching my head at this error from the .NET Framework DataBinding: &#8216;MyApp.vo.customVO&#8217; does not contain a property with the name &#8216;Name&#8217; I was stumped because my custom VO class did in fact have a public property called Name.  After many trials and tribulations I figured out that .NET didn&#8217;t like how I [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was scratching my head at this error from the .NET Framework</p>
<blockquote>
<h3><em><em>DataBinding: &#8216;MyApp.vo.customVO&#8217; does not contain a property with the name &#8216;Name&#8217;</em></em></h3>
</blockquote>
<p>I was stumped because my custom VO class did in fact have a public property called Name.  After many trials and tribulations I figured out that .NET didn&#8217;t like how I structured my custom class.</p>
<p>Here is what my original custom class looked like.</p>
<pre class="brush: csharp;">
namespace MyApp.vo
{
    public class customVO
    {
        public Int32 id  = 0;
        public DateTime time  = new DateTime();
        public string Name  = string.Empty;
        public string DeviceType  = string.Empty;
        public string ObjectIDs  = string.Empty;
    }
}
</pre>
<p>Luckily I have <a title="JetBrain's ReSharper is a must have for any .NET developer" href="http://www.jetbrains.com/resharper/" target="_blank">JetBrains ReSharper</a> installed, and it suggested using C#&#8217;s <a href="http://msdn.microsoft.com/en-us/library/bb384054.aspx" target="_blank">Auto-Implemented properties</a>.  This is the one thing I hadn&#8217;t thought about trying, and it ended up being the fix!  My new custom VO class now looks like this.</p>
<pre class="brush: csharp;">
namespace MyApp.vo
{
    public class customVO
    {
        public Int32 id { get; set; }
        public DateTime time { get; set; }
        public string DeviceType { get; set; }
        public string ObjectIDs { get; set; }
        public string Name { get; set; }
    }
}
</pre>
<p>So if you find yourself running into this error while trying to DataBind a collection of custom classes to a ListBox or similar control, have a look at your custom class and see if you can convert it over to using auto-implement properties as well.</p>
<p>Now I&#8217;m not suggesting this is the only way to DataBind a List of custom classes to a ListBox, but it solved my problem and let me do direct databinding from my service call without having to do any pre-processing on my list.</p>
<p>Hope this helps someone else.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/04/databind-a-list-of-custom-classes-to-an-asplistbox-control/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to TWEET from a SQL CLR Stored Procedure</title>
		<link>http://ericfickes.com/2010/03/how-to-tweet-from-a-sql-crl-stored-procedure/</link>
		<comments>http://ericfickes.com/2010/03/how-to-tweet-from-a-sql-crl-stored-procedure/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 01:10:58 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[tsql]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[.net assembly]]></category>
		<category><![CDATA[.net Common Language Runtime]]></category>
		<category><![CDATA[CLR]]></category>
		<category><![CDATA[CLR SPROC]]></category>
		<category><![CDATA[sproc]]></category>
		<category><![CDATA[sql server 2005]]></category>
		<category><![CDATA[stored procedure]]></category>
		<category><![CDATA[tweet]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1133</guid>
		<description><![CDATA[Here&#8217;s another SQL Server 2005 geek out moment, a CLR SPROC that tweets to Twitter. Big shoutout to Danny Battison for sharing the C# code to post to Twitter. This is what got me started on the C# side of things.  Also, you can skip all my ramblings here and just download code here and [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s another SQL Server 2005 geek out moment, a CLR SPROC that tweets to Twitter.  Big shoutout to <a title="Danny Battison is a C# rocker!" href="http://www.dreamincode.net/code/snippet2556.htm" target="_blank">Danny Battison for sharing the C# code to post to Twitter</a>.  This is what got me started on the C# side of things.  Also, you can skip all my ramblings here and just <a title="CLR SPROC &gt; Tweetsproc sample code" href="http://ericfickes.com/code/tweetsproc.zip" target="_blank">download code here</a> and fire it up.  The zip file contains all the source code, the compiled assembly file, and install.sql that shows you how to hook this up.</p>
<p>Being the SQL junky that I am, I was interested in trying out SQL Server&#8217;s new  <a title="CLR Stored Procedures on MSDN" href="http://msdn.microsoft.com/en-us/library/ms131094.aspx" target="_blank">CLR Stored Procedures</a>.  A CLR sproc is a stored procedure that is able to use .net code that you&#8217;ve compiled into an assembly file.  For you classic ASP heads out there, think of the ASP page being the sproc, and the .net assembly being your COM object ( cringe, let&#8217;s talk about classic ASP ).  While there are plenty of great articles on <a title="Writing CLR Stored Procedures on SQLTEAM.com" href="http://www.sqlteam.com/article/writing-clr-stored-procedures-in-charp-introduction-to-charp-part-1" target="_blank">writing CLR stored procedures</a>, I&#8217;m going to breeze through the code that makes up this project.</p>
<h2>First make a .net class library that will be compiled into an assembly file.</h2>
<pre class="brush: csharp;">
using System;
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;

/// &lt;summary&gt;
/// This assembly will be used by a SQL2005 SPROC to communicate
/// with twitter.com
/// &lt;/summary&gt;
public sealed class tweetsproc
{
    /*
     * TWITTER CODE BORROWED FROM :
     *  http://www.dreamincode.net/code/snippet2556.htm
     *
     * A function to post an update to Twitter programmatically
     * Author: Danny Battison
     * Contact: gabehabe@hotmail.com
     */

    /// &lt;summary&gt;
    /// Post an update to a Twitter acount
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;username&quot;&gt;The username of the account&lt;/param&gt;
    /// &lt;param name=&quot;password&quot;&gt;The password of the account&lt;/param&gt;
    /// &lt;param name=&quot;tweet&quot;&gt;The status to post&lt;/param&gt;
    [Microsoft.SqlServer.Server.SqlProcedure(Name = &quot;PostTweet&quot;)]
    //public static void PostTweet( string username, string password, string tweet)
    public static void PostTweet(   SqlString username,
                                    SqlString password,
                                    SqlString tweet)
    {
        try
        {
            // encode the username/password
            string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username.ToString() + &quot;:&quot; + password.ToString()));
            // determine what we want to upload as a status
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes(&quot;status=&quot; + tweet.ToString());

            // Create a WebPermission.
            WebPermission myWebPermission1 = new WebPermission();

            // Allow Connect access to the specified URLs.
            myWebPermission1.AddPermission(NetworkAccess.Connect,new Regex(&quot;http://www\\.twitter\\.com/.*&quot;,
              RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline));

            myWebPermission1.Demand();

            // connect with the update page
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(&quot;http://twitter.com/statuses/update.xml&quot;);

            // set the method to POST
            request.Method = &quot;POST&quot;;
            request.ServicePoint.Expect100Continue = false; // thanks to argodev for this recent change!
            // set the authorisation levels
            request.Headers.Add(&quot;Authorization&quot;, &quot;Basic &quot; + user);
            request.ContentType = &quot;application/x-www-form-urlencoded&quot;;
            // set the length of the content
            request.ContentLength = bytes.Length;

            // set up the stream
            Stream reqStream = request.GetRequestStream();
            // write to the stream
            reqStream.Write(bytes, 0, bytes.Length);
            // close the stream
            reqStream.Close();

            // Let's get the Response from Twitter
            var webresp = request.GetResponse();
            // Let's read the Response
            var sread = new StreamReader( webresp.GetResponseStream() );

            // Use SqlContext to return data to the QueryAnalyzer results window
            SqlContext.Pipe.Send( sread.ReadToEnd() );

        }
        catch (Exception exc)
        {
            // send error back
            SqlContext.Pipe.Send(exc.Message);
        }
    }
}
</pre>
<h3>Here&#8217;s the app.config for this assembly.</h3>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;configuration&gt;
  &lt;system.web&gt;
    &lt;trust level=&quot;Full&quot; processRequestInApplicationTrust=&quot;true&quot; originUrl=&quot;&quot; /&gt;
  &lt;/system.web&gt;
&lt;/configuration&gt;
</pre>
<p>Once you build this project, you should have your assembly ( tweetsproc.dll ) which will be used by your CLR Sproc.  Now it&#8217;s time to do some SQL server work.</p>
<h2>Enable CLR access for SQL server</h2>
<pre class="brush: sql;">
EXEC sp_configure @configname = 'clr enabled', @configvalue = 1
RECONFIGURE WITH OVERRIDE
GO
</pre>
<h2>Create the SQL Assembly</h2>
<pre class="brush: sql;">
CREATE ASSEMBLY tweetsproc_clr_assembly from 'C:\Users\eric\Desktop\blog\tweetsproc.dll'
WITH PERMISSION_SET = EXTERNAL_ACCESS
GO
</pre>
<h2>Create your SPROC</h2>
<pre class="brush: sql;">
CREATE PROC tweetsproc_tweet(	@username as nvarchar(50),
								@password as nvarchar(50),
								@tweet as nvarchar(140)
							)
AS
	-- [Assembly Name].[Class Name].[CLR function Name]
	EXTERNAL NAME tweetsproc_clr_assembly.tweetsproc.PostTweet
GO
</pre>
<h2>Tweet from a sproc</h2>
<pre class="brush: sql;">EXEC tweetsproc_tweet 'TwitterUsername', 'TwitterPassword', 'Hey @ericfickes, I''m tweeting from my database too!'</pre>
<p>Running this sproc returns the XML response from Twitter.</p>
<div id="attachment_1142" class="wp-caption aligncenter" style="width: 678px"><a href="http://ericfickes.com/wp-content/uploads/2010/03/tweetsproc_tweet-response1.png" rel="lightbox[1133]"><img class="size-full wp-image-1142" title="Twitter response from tweet sproc" src="http://ericfickes.com/wp-content/uploads/2010/03/tweetsproc_tweet-response1.png" alt="Twitter response from tweet sproc" width="668" height="719" /></a><p class="wp-caption-text">Tweetsproc returns the full Twitter response</p></div>
<p>That&#8217;s one sample CLR SPROC in the bank!  Feel free to download this code and try it out yourself.  I&#8217;d love to get some feedback on anybody looking to use this for real.  While tweeting from a stored procedure probably isn&#8217;t a hot topic for anybody, this is a nice teaser for what you can do with CLR sprocs now.</p>
<p><a title="CLR SPROC &gt; Tweetsproc sample code" href="http://ericfickes.com/code/tweetsproc.zip" target="_blank">Download code here.</a></p>
<p>Inside this zip you&#8217;ll find this.</p>
<ul>
<li>install.sql is everything you need to install this on your database</li>
<li>tweetsproc.dll is the twitter assembly used by the sproc</li>
<li>tweetsproc folder is the .net class library project</li>
</ul>
<div id="attachment_1139" class="wp-caption aligncenter" style="width: 289px"><a href="http://ericfickes.com/wp-content/uploads/2010/03/tweetsproczip.png" rel="lightbox[1133]"><img class="size-full wp-image-1139" title="Contents of tweetsproc.zip" src="http://ericfickes.com/wp-content/uploads/2010/03/tweetsproczip.png" alt="Contents of tweetsproc.zip" width="279" height="114" /></a><p class="wp-caption-text">Everything you need to get TWEETING from a sproc</p></div>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/03/how-to-tweet-from-a-sql-crl-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>How to JOIN two tables using LINQ to SQL</title>
		<link>http://ericfickes.com/2010/02/how-to-join-two-tables-using-linq-to-sql/</link>
		<comments>http://ericfickes.com/2010/02/how-to-join-two-tables-using-linq-to-sql/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 01:27:53 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[linq to sql]]></category>
		<category><![CDATA[linqtosql]]></category>
		<category><![CDATA[query]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1065</guid>
		<description><![CDATA[Wanted to share this since it gave me so much trouble figuring out.  It&#8217;s a simple SQL query ported to LINQ to SQL that joins two tables to return a filtered listed of data. Here are the tables from my schema Here is a basic SQL statement I could fire to retrieve my user videos. [...]]]></description>
			<content:encoded><![CDATA[<p>Wanted to share this since it gave me so much trouble figuring out.  It&#8217;s a simple SQL query ported to LINQ to SQL that joins two tables to return a filtered listed of data.</p>
<p>Here are the tables from my schema<br />
<a href="http://ericfickes.com/wp-content/uploads/2010/02/user-user_videos-video.png" rel="lightbox[1065]"><img class="aligncenter size-full wp-image-1068" title="My three user tables" src="http://ericfickes.com/wp-content/uploads/2010/02/user-user_videos-video.png" alt="user, user_video, video tables" width="465" height="317" /></a></p>
<p>Here is a basic SQL statement I could fire to retrieve my user videos.</p>
<pre class="brush: sql;">
select  *
from    video v, user_videos uv
where   v.vid = uv.vid
and     uv.uid = 2
</pre>
<p><a href="http://ericfickes.com/wp-content/uploads/2010/02/uservideos-SQL.png" rel="lightbox[1065]"><img class="aligncenter size-full wp-image-1069" title="Data returned from this SQL statement" src="http://ericfickes.com/wp-content/uploads/2010/02/uservideos-SQL.png" alt="User 2 has two videos" width="499" height="220" /></a><br />
Here is how you would run the same query using .net&#8217;s LINQ to SQL.</p>
<pre class="brush: csharp;">
// create DB connection
var db = new DBCONN();
// run query
List&lt;video&gt; uvids = (
    from c in db.video
    join o in db.user_videos
    on c.vid equals o.vid
    where o.uid == 2
    select c
).ToList();
</pre>
<p>This query differs slightly from the screenshot below because I used it in a WCF Service.</p>
<p><a href="http://ericfickes.com/wp-content/uploads/2010/02/uservideos-LINQTOSQL.png" rel="lightbox[1065]"><img class="aligncenter size-full wp-image-1070" title="Same query run via LINQ to SQL" src="http://ericfickes.com/wp-content/uploads/2010/02/uservideos-LINQTOSQL.png" alt="Same data, different retrieval method" width="488" height="419" /></a></p>
<p>The variable DBCONN is my database connection that I established when mapping my DB.  If you are not familiar with how to set this up, use the Visual Studio&#8217;s &#8220;Add the ADO.NET Entity Data Model&#8221; wizard.  With your .net project open, right click your project, left click on &#8220;Add the ADO.NET Entity Data Model&#8221;.  This wizard will walk you through setting up everything you need to setup your DB model file ( edmx ), as well as setting up your database connection and saving it in web.config.</p>
<p>Jesse Liberty did a <a title="ADO.NET DataEntities and WCF Feeding a Silverlight DataGrid" href="http://silverlight.net/learn/tutorials/adonetdataentities-cs/" target="_blank">simple tutorial that uses this wizard in a WCF service application</a>.</p>
<p>I hope this helps somebody out.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/02/how-to-join-two-tables-using-linq-to-sql/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Come have a 360Flex chat with me and Jun Heider</title>
		<link>http://ericfickes.com/2010/02/come-have-a-360flex-chat-when-me-and-jun-heider/</link>
		<comments>http://ericfickes.com/2010/02/come-have-a-360flex-chat-when-me-and-jun-heider/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 23:16:52 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[360flex]]></category>
		<category><![CDATA[adobeconnect]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[jun heider]]></category>
		<category><![CDATA[speaker]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1060</guid>
		<description><![CDATA[Chat is @ Thursday Feb 11th, 11:30am MST Jun Heider and myself will be talking to the 360&#124;Flex guys tomorrow about our session.  It’s actually going to be a back-to-back mega session comparing the latest and greatest on both the Flash Platform and the Silverlight Platform. Come check it out and feel free to ask [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Chat is @ Thursday Feb 11th, 11:30am MST</strong></p>
<p><a href="http://www.iheartair.com/" target="_blank">Jun Heider</a> and myself will be talking to the 360|Flex guys tomorrow about our session.  It’s actually going to be a back-to-back mega session comparing the latest and greatest on both the Flash Platform and the Silverlight Platform.</p>
<p>Come check it out and feel free to ask questions…although for the good stuff you’ll have to wait until our talks. <img src="http://www.iheartair.com/wp-includes/images/smilies/icon_wink.gif" alt=";-)" /></p>
<p>Here’s the full details: <a href="http://www.360flex.com/blog/2010/02/360flex-speaker-chat-eric-fickes-and-jun-heider/">http://www.360flex.com/blog/2010/02/360flex-speaker-chat-eric-fickes-and-jun-heider/</a></p>
<p>I hope to see you online tomorrow or at 360 Flex in March.</p>
<div class="wp-caption aligncenter" style="width: 110px"><br />
<a href="http://360flex-ericf.eventbrite.com/" target="_blank"><br />
<img title="I'm speaking at 360 Flex 2010" src="http://ericfickes.com/code/badge-2.png" alt="I'm speaking at 360 Flex 2010" width="100" height="100" /></a><p class="wp-caption-text">I&#39;m speaking at 360 Flex 2010</p></div>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/02/come-have-a-360flex-chat-when-me-and-jun-heider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Invalid token &#8216;void&#8217; in class, struct, or interface member declaration</title>
		<link>http://ericfickes.com/2010/02/invalid-token-void-in-class-struct-or-interface-member-declaration/</link>
		<comments>http://ericfickes.com/2010/02/invalid-token-void-in-class-struct-or-interface-member-declaration/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 23:32:34 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[ADO.NET Entity Data Model]]></category>
		<category><![CDATA[edmx]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[visual studio 2008]]></category>
		<category><![CDATA[void]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=1041</guid>
		<description><![CDATA[EDIT : After finishing this post I ran into all sorts of other strange issues and restarted using a Web Appliction instead of a plain old Website.  Between IntelliSense not showing any classes, to project reference issues, I couldn&#8217;t figured it out in time.  I&#8217;m sure there&#8217;s a way, I just had to move on.  So [...]]]></description>
			<content:encoded><![CDATA[<h2>EDIT :</h2>
<p>After finishing this post I ran into all sorts of other strange issues and restarted using a Web Appliction instead of a plain old Website.  Between <a title="IntelliSense is the BEST feature of all Visual Studios" href="http://en.wikipedia.org/wiki/IntelliSense" target="_blank">IntelliSense</a> not showing any classes, to project reference issues, I couldn&#8217;t figured it out in time.  I&#8217;m sure there&#8217;s a way, I just had to move on.  So maybe this ramble below will be helpful for someone.</p>
<address>EF</address>
<p>Just ran into something quirky with Visual Studio 2008&#8242;s new ADO.NET Entity Data Model wizard.  While working on an ASP.NET 3.5 website ( not a codebehind web application ) I was trying to get the ADO.NET Entity Data model wizard to work with MySQL and ran into a probable Visual Studio bug.  To sum up the issue, if you are going to add a new edmx to your project, do NOT save it to the App_Code folder initially.  Put it in your root folder, compile your project, then move the edmx where you&#8217;d like.</p>
<p>Assuming you&#8217;ve already created your ASP.NET Website project, here&#8217;s how you reproduce this issue.</p>
<h3 style="text-align: center;"><strong>Right click your project and left click &#8216;Add New Item&#8217;</strong></h3>
<p style="text-align: center;">
<div id="attachment_1042" class="wp-caption aligncenter" style="width: 390px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs1-AddNewItem.png" rel="lightbox[1041]"><img class="size-full wp-image-1042" title="Add New Item" src="http://ericfickes.com/wp-content/uploads/2010/02/vs1-AddNewItem.png" alt="Right click your project, left click Add New Item" width="380" height="225" /></a><p class="wp-caption-text">Add New Item</p></div>
<h3 style="text-align: center;"><strong>Select ADO.NET Entity Data Model, name it, select your language of preference</strong></h3>
<p style="text-align: center;">
<div id="attachment_1045" class="wp-caption aligncenter" style="width: 372px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs2-NewEDM1.png" rel="lightbox[1041]"><img class="size-full wp-image-1045" title="New ADO.NET Entity Data Model" src="http://ericfickes.com/wp-content/uploads/2010/02/vs2-NewEDM1.png" alt="New ADO.NET Entity Data Model" width="362" height="466" /></a><p class="wp-caption-text">ADO.NET Entity Data Model</p></div>
<h3 style="text-align: center;"><strong>Click Yes to the &#8216;Store in App_Code&#8217; prompt</strong></h3>
<p style="text-align: center;"><strong> </strong></p>
<div id="attachment_1046" class="wp-caption aligncenter" style="width: 500px"><strong><strong><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs3-AddToAPP_CODE.png" rel="lightbox[1041]"><img class="size-full wp-image-1046" title="Place your edmx in App_Code folder" src="http://ericfickes.com/wp-content/uploads/2010/02/vs3-AddToAPP_CODE.png" alt="Place your edmx in App_Code folder" width="490" height="199" /></a></strong></strong><p class="wp-caption-text">Place file in &#39;App_Code&#39; folder</p></div>
<p><strong> </strong></p>
<h3 style="text-align: center;"><strong>Complete the new Entity Data Model wizard</strong></h3>
<p style="text-align: center;"><a title="ADO.NET DataEntities and WCF Feeding a Silverlight DataGrid" href="http://silverlight.net/learn/tutorials/adonetdataentities-cs/" target="_blank">See this tutorial if you have not done this before</a></p>
<p style="text-align: center;">
<p style="text-align: center;">
<h3 style="text-align: center;"><strong>Compile project after completing wizard</strong></h3>
<p style="text-align: left;">
<div id="attachment_1047" class="wp-caption aligncenter" style="width: 665px"><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs4-BuildFail.png" rel="lightbox[1041]"><img class="size-full wp-image-1047" title="Invalid token 'void' in class, struct, or interface member declaration" src="http://ericfickes.com/wp-content/uploads/2010/02/vs4-BuildFail.png" alt="Invalid token 'void' in class, struct, or interface member declaration" width="655" height="399" /></a><p class="wp-caption-text">Invalid token &#39;void&#39; in class, struct, or interface member declaration</p></div>
<p style="text-align: left;">At this point your project should have a new.edmx file located inside of the App_Code folder, but the project won&#8217;t build without failing.  If you are stuck in this predicament, follow this workaround.</p>
<h3 style="text-align: center;"><strong>Move .edmx to root folder and rebuild</strong></h3>
<p style="text-align: left;"><strong> </strong></p>
<div id="attachment_1048" class="wp-caption aligncenter" style="width: 346px"><strong><strong><a href="http://ericfickes.com/wp-content/uploads/2010/02/vs5-move_edmx.png" rel="lightbox[1041]"><img class="size-full wp-image-1048" title="Move edmx to root and recompile, no errors!" src="http://ericfickes.com/wp-content/uploads/2010/02/vs5-move_edmx.png" alt="Move edmx to root and recompile, no errors!" width="336" height="468" /></a></strong></strong><p class="wp-caption-text">WORKAROUND : move edmx to root folder, then recompile</p></div>
<p><strong> </strong></p>
<p style="text-align: left;">
<p style="text-align: left;">After moving your edmx file to the root folder you should be able to compile without problem.  Assuming this solves your problem, you should be able to move your edmx file to the App_Code folder without problem.  Seems like an initial compile problem<strong>.<br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2010/02/invalid-token-void-in-class-struct-or-interface-member-declaration/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Find out why Visual Studio&#8217;s publish fails</title>
		<link>http://ericfickes.com/2009/08/find-out-why-visual-studios-publish-fails/</link>
		<comments>http://ericfickes.com/2009/08/find-out-why-visual-studios-publish-fails/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 18:51:26 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[build options]]></category>
		<category><![CDATA[msbuild]]></category>
		<category><![CDATA[output panel]]></category>
		<category><![CDATA[publish]]></category>
		<category><![CDATA[publish failed]]></category>
		<category><![CDATA[publish options]]></category>
		<category><![CDATA[verbosity]]></category>
		<category><![CDATA[visual studio 2008]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=876</guid>
		<description><![CDATA[Have you ever had Visual Studio tell you your web application publish failed, but never gives you a reason why?  You&#8217;re not alone.  I&#8217;ve been putting off looking into this issue on a project and just found a way to get my answer right away. Here&#8217;s what you should do inside of Visual Studio to [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever had Visual Studio tell you your web application publish failed, but never gives you a reason why?  You&#8217;re not alone.  I&#8217;ve been putting off looking into this issue on a project and just found a way to get my answer right away.</p>
<div id="attachment_877" class="wp-caption aligncenter" style="width: 276px"><a href="http://ericfickes.com/wp-content/uploads/2009/08/visual-studio-2008-publish-failed.gif" rel="lightbox[876]"><img class="size-full wp-image-877" title="visual-studio-2008-publish-failed" src="http://ericfickes.com/wp-content/uploads/2009/08/visual-studio-2008-publish-failed.gif" alt="Visual Studio 2008's Publish Failed message" width="266" height="112" /></a><p class="wp-caption-text">Visual Studio 2008&#39;s Publish Failed message</p></div>
<p>Here&#8217;s what you should do inside of Visual Studio to find out why your publish failed.</p>
<ol>
<li>Click the Tools menu &gt; then Options to bring up the Options dialog.</li>
<li>Expand &#8216;Projects and Solutions&#8217; on the left and click General</li>
<li>On General, click &#8216;Show Output window when build starts&#8217;</li>
<li>Now click on &#8216;Build and Run&#8217; in the left tree</li>
<li>Next select a value from the &#8216;MSBuild project build output verbosity&#8217; drop down menu</li>
<li>OK your way back to the main Visual Studio window</li>
<li>The next time you Build or Publish your project, you should see the Output panel pop up.  If your publish is still failing, the answer will live inside the Output panel</li>
</ol>
<p>Here&#8217;s a visual walkthrough of these instructions.</p>
<div id="attachment_878" class="wp-caption aligncenter" style="width: 310px"><a href="http://ericfickes.com/wp-content/uploads/2009/08/show-output-window-when-build-starts.gif" rel="lightbox[876]"><img class="size-medium wp-image-878" title="show-output-window-when-build-starts" src="http://ericfickes.com/wp-content/uploads/2009/08/show-output-window-when-build-starts-300x172.gif" alt="Tools &gt; Options &gt; Projects and Solutions &gt; General" width="300" height="172" /></a><p class="wp-caption-text">Tools &gt; Options &gt; Projects and Solutions &gt; General</p></div>
<div id="attachment_879" class="wp-caption aligncenter" style="width: 310px"><a href="http://ericfickes.com/wp-content/uploads/2009/08/msbuild-project-build-output-verbosity.gif" rel="lightbox[876]"><img class="size-medium wp-image-879" title="msbuild-project-build-output-verbosity" src="http://ericfickes.com/wp-content/uploads/2009/08/msbuild-project-build-output-verbosity-300x171.gif" alt="Tools &gt; Options &gt; Projects and Solutions &gt; Build and Run" width="300" height="171" /></a><p class="wp-caption-text">Tools &gt; Options &gt; Projects and Solutions &gt; Build and Run</p></div>
<div id="attachment_880" class="wp-caption aligncenter" style="width: 310px"><a href="http://ericfickes.com/wp-content/uploads/2009/08/visual-studio-output-panel.gif" rel="lightbox[876]"><img class="size-medium wp-image-880" title="visual-studio-output-panel" src="http://ericfickes.com/wp-content/uploads/2009/08/visual-studio-output-panel-300x102.gif" alt="Visual Studio's Output Panel" width="300" height="102" /></a><p class="wp-caption-text">Visual Studio&#39;s Output Panel</p></div>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2009/08/find-out-why-visual-studios-publish-fails/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Create a delimited list of SortedList Keys in C#</title>
		<link>http://ericfickes.com/2009/02/create-a-delimited-list-of-sortedlist-keys-in-c/</link>
		<comments>http://ericfickes.com/2009/02/create-a-delimited-list-of-sortedlist-keys-in-c/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 22:39:53 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[implode]]></category>
		<category><![CDATA[SortedList]]></category>

		<guid isPermaLink="false">http://ericfickes.com/?p=486</guid>
		<description><![CDATA[I love C#, but miss the simplicity of PHP sometimes.  Specifically when dealing with collections.  Recently I ran into a situation where PHP&#8217;s implode would have been perfect, but I wasn&#8217;t able to find any quick and easy built in solution. I would like to be able to do this string id_list = implode( &#34;,&#34;, [...]]]></description>
			<content:encoded><![CDATA[<p>I love C#, but miss the simplicity of PHP sometimes.  Specifically when dealing with collections.  Recently I ran into a situation where <a title="Read the docs on implode( glue, array_pieces )" href="http://php.net/implode" target="_blank">PHP&#8217;s implode</a> would have been perfect, but I wasn&#8217;t able to find any quick and easy built in solution.</p>
<p>I would like to be able to do this</p>
<pre class="brush: csharp;">
string id_list = implode( &quot;,&quot;, mySortedList.Keys );
</pre>
<p>I&#8217;m not aware of any built in ways to do this, so I wrote the following helper function.</p>
<pre class="brush: csharp;">
///
/// Pass in a SortedList and this will return a string containing a delimited
/// list of keys separated by delim
///
///

///

/// key1{DELIM}key2{DELIM}keyN
public static string SortedListKeysToDelimList(SortedList sl, string delim)
{
StringBuilder sb_keys = new StringBuilder();

foreach (DictionaryEntry dl in sl)
{
sb_keys.Append( dl.Key.ToString() );

// append DELIM only if we're NOT on the last entry
if (dl.Key != sl.GetKey(sl.Keys.Count - 1))
{
sb_keys.Append( delim );
}
}

return sb_keys.ToString();
}
</pre>
<p>If there is any better way to do this, please leave me a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2009/02/create-a-delimited-list-of-sortedlist-keys-in-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Send custom objects from Flash to ASP.NET web service ( asmx )</title>
		<link>http://ericfickes.com/2006/08/send-custom-objects-from-flash-to-aspnet-web-service-asmx/</link>
		<comments>http://ericfickes.com/2006/08/send-custom-objects-from-flash-to-aspnet-web-service-asmx/#comments</comments>
		<pubDate>Wed, 02 Aug 2006 22:03:00 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[asmx]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[custom class]]></category>
		<category><![CDATA[flash remoting]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://ericfickes.com/2006/08/02/80/</guid>
		<description><![CDATA[I came across a new server message today &#8211; &#8220;The test form is only available for methods with primitive types or arrays of primitive types as parameters&#8221; While working with flash and asp.net web services I learned that you can send a custom class object to an ASMX. That service can then take your object [...]]]></description>
			<content:encoded><![CDATA[<p>I came across a new server message today &#8211; &#8220;<span style="font-weight: bold;">The test form is only available for methods with primitive types or arrays of primitive types as parameters</span>&#8221;</p>
<p>While working with flash and asp.net web services I learned that you can send a custom class object to an ASMX.  That service can then take your object and have it&#8217;s way with it.  This is pretty killer because you can share custom classes between .net and as, assuming the class definitions match, and the datatypes don&#8217;t get too complex.</p>
<p>If you have to work with webservices from flash, checkout the WebService class.  It&#8217;s sweet.  So much so that I don&#8217;t understand why I even need Flash Remoting.  I mean, I can send and receive my custom class on the flash side as well as the .net side.</p>
<p>Currently I only see the following limitations with this magic flash to soap communicado.</p>
<ol>
<li>No test form on the .asmx page.  For a typical asmx file, the .net server can generate a simple test form that you can use to test your webservice.  It&#8217;s great, except for a service that expects your custom class as input</li>
<li>Simple data types.  I haven&#8217;t tested the waters of what datatypes you can use in your custom object, but I&#8217;m guessing you can&#8217;t venture outside of the basic strings and numbers.</li>
</ol>
<p>I&#8217;m pretty pumped about learning the AS WebService class.  It&#8217;s so much nicer than the olden days of parsing name value pairs, or even a full on xml object.  The WebService class does all the magic for you in flash, and you code up the result object as you&#8217;ve defined your custom object.</p>
<p>end of line</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2006/08/send-custom-objects-from-flash-to-aspnet-web-service-asmx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;m an MCP for C#</title>
		<link>http://ericfickes.com/2006/06/im-an-mcp-for-c/</link>
		<comments>http://ericfickes.com/2006/06/im-an-mcp-for-c/#comments</comments>
		<pubDate>Sat, 24 Jun 2006 21:55:00 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>

		<guid isPermaLink="false">http://ericfickes.com/2006/06/24/77/</guid>
		<description><![CDATA[I finally got my MCP Welcome Kit from Microsoft.]]></description>
			<content:encoded><![CDATA[<p>I finally got my MCP Welcome Kit from Microsoft.</p>
<p><a href="http://photos1.blogger.com/blogger/1587/58/1600/mcp_logo.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" rel="lightbox[77]"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://photos1.blogger.com/blogger/1587/58/320/mcp_logo.jpg" border="0" alt="Eric Fickes is a Microsoft Certified Professional" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2006/06/im-an-mcp-for-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serialize an ASP.NET control into it&#8217;s html source code</title>
		<link>http://ericfickes.com/2006/05/serialize-an-aspnet-control-into-its-html-source-code/</link>
		<comments>http://ericfickes.com/2006/05/serialize-an-aspnet-control-into-its-html-source-code/#comments</comments>
		<pubDate>Wed, 03 May 2006 16:07:00 +0000</pubDate>
		<dc:creator>Eric Fickes</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[serialize]]></category>

		<guid isPermaLink="false">http://ericfickes.com/2006/05/03/72/</guid>
		<description><![CDATA[Here&#8217;s a handy little routine that takes an ASP.NET control and spits out the html source for use in code. I&#8217;ve used this with ASCX files, but I think it should work with any type of asp:control ( ascx, server control, html control, etc ). #region RenderToString using System.IO; using System.Text; using System.Web.UI; public string [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: trebuchet ms;">Here&#8217;s a handy little routine that takes an ASP.NET control and spits out the html source for use in code.  I&#8217;ve used this with ASCX files, but I think it should work with any type of asp:control ( ascx, server control, html control, etc ).</span></p>
<pre class="brush: csharp;">
#region RenderToString
using System.IO;
using System.Text;
using System.Web.UI;

public string RenderToString(Control ctrl)
{
StringWriter stringWriter = new StringWriter();

HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);

ctrl.RenderControl(htmlWriter);

StringBuilder stringBuilder = stringWriter.GetStringBuilder();

return stringBuilder.ToString();
}

#endregion
</pre>
<p>This came in handy when I was working on a mass mailer app. Instead of hard coding my email message into my codebehind, I just made an ASCX control for each message, then loaded the correct message in my code, ran it through this routine, and sent it out.</p>
<p>By putting the message into an ASCX file, it makes formatting HTML much easier than putting it in C# code. If you&#8217;ve ever programmed any sort of emailer that sends an HTML message, you know what a pain this can be.</p>
<p>I would like to think there is an easier way to do an include file via code, populate the message with some variables, then send it out, but I haven&#8217;t found it yet.  If you know of an easier way, I want to hear about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericfickes.com/2006/05/serialize-an-aspnet-control-into-its-html-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
