<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>tateeda</title>
	<atom:link href="http://tateeda.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tateeda.wordpress.com</link>
	<description>Just another WordPress.com site</description>
	<lastBuildDate>Thu, 28 Jul 2011 21:25:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='tateeda.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>tateeda</title>
		<link>http://tateeda.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://tateeda.wordpress.com/osd.xml" title="tateeda" />
	<atom:link rel='hub' href='http://tateeda.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Generic extensions with System.Reflection and data copying</title>
		<link>http://tateeda.wordpress.com/2011/07/27/generic-extensions-with-reflection-for-data-copying/</link>
		<comments>http://tateeda.wordpress.com/2011/07/27/generic-extensions-with-reflection-for-data-copying/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 04:18:36 +0000</pubDate>
		<dc:creator>Tateeda.com</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[CLIRES-3]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[MVC 3]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[WPF - C#]]></category>

		<guid isPermaLink="false">http://tateeda.wordpress.com/?p=27</guid>
		<description><![CDATA[For my EF (Entity Framework 4.1) I was using POCO templates to generate DTOs. POCO are very simple objects but I did want to separate my MVC UI from Entity Framework dependency, so I&#8221;ve used a wrapper classes for my POCO classes from EF. Something like this, where Medication would be a POCO templated class from EF and MedicationModel [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tateeda.wordpress.com&amp;blog=24900017&amp;post=27&amp;subd=tateeda&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For my EF (Entity Framework 4.1) I was using POCO templates to generate DTOs.</p>
<p>POCO are very simple objects but I did want to separate my MVC UI from Entity Framework dependency, so I&#8221;ve used a wrapper classes for my POCO classes from EF.</p>
<p>Something like this, where Medication would be a POCO templated class from EF and MedicationModel is a wrapper.</p>
<p>public class MedicationModel:Mediation{</p>
<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..</p>
<p>}</p>
<p>Another approach could be a total encapsulation of Medication class, but&#8230; I did it this way.</p>
<p>Well so far so good, but the question was how to convert and/or assign data to a simple entity to persist it in DB?</p>
<p>My solution in this case was simple. I created an extension for my classes.</p>
<p>All of my extensions would implement one method on the common static extension class:</p>
<p>Snippet from the extension class.</p>
<pre>       public static List&lt;AppointmentForm&gt; ToAppointmentFormList(this ICollection&lt;AppointmentFormModel&gt; forms) {
            List&lt;AppointmentForm&gt; list = new List&lt;AppointmentForm&gt;();
            foreach (var f in forms) {
                list.Add(f.ToAppointmentForm());
            }
            return list;
        }

        #region - Base function for Objects conversions -

        private static void To&lt;F, T&gt;(F from, ref T to) {
            ExtentionBase.To&lt;F, T&gt;(from, ref to);
        }

        #endregion - Base function for Objects conversions -
The base Generic method looks like this:
public static class ExtentionBase {
        #region - Base function for Objects conversions -

        public static void To&lt;F, T&gt;(F from, ref T to) {
            if (from != null) {
                Type fromType = from.GetType();
                Type toType = to.GetType();

                PropertyInfo[] fromPropertyInfo = fromType.GetProperties();
                PropertyInfo[] toPropertyInfo = toType.GetProperties();

                foreach (var prop in fromPropertyInfo) {
                    var targetProperty = toType.GetProperty(prop.Name);
                    if (targetProperty != null &amp;&amp; targetProperty.CanWrite) {
                        try {
                            var value = prop.GetValue(from, null);
                            if (value != null &amp;&amp; (value.GetType().BaseType.Name.ToString().Equals("ValueType") ||
                                                  value.GetType().BaseType.Name.ToString().Equals("Object") ||
                                                  value.GetType().BaseType.Name.ToString().Equals("RelatedEnd"))
                               ) {
                                targetProperty.SetValue(to, value, null);
                            }
                        } catch {
                            Console.Out.WriteLine("Error");
                        }
                    }
                }
            }
        }

        #endregion - Base function for Objects conversions -
    }
To get the source code goto: <a title="Source Code" href="http://clires3.codeplex.com" target="_blank">http://clires3.codeplex.com</a>
To see the app demo goto <a title="DEMO site" href="http://clires.tateeda.com">http://clires.tateeda.com</a></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tateeda.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tateeda.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tateeda.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tateeda.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tateeda.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tateeda.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tateeda.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tateeda.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tateeda.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tateeda.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tateeda.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tateeda.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tateeda.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tateeda.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tateeda.wordpress.com&amp;blog=24900017&amp;post=27&amp;subd=tateeda&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tateeda.wordpress.com/2011/07/27/generic-extensions-with-reflection-for-data-copying/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/862686305087c6809f0a548c04be47cc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tateeda</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF &#8211; WCF List serialization issue.</title>
		<link>http://tateeda.wordpress.com/2011/07/26/wpf-wcf-list-serialization-issue/</link>
		<comments>http://tateeda.wordpress.com/2011/07/26/wpf-wcf-list-serialization-issue/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 03:18:32 +0000</pubDate>
		<dc:creator>Tateeda.com</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF - C#]]></category>

		<guid isPermaLink="false">http://tateeda.wordpress.com/?p=22</guid>
		<description><![CDATA[I have run into issue with data serialization today. I needed to update my very complex object by calling WCF services. Here is the error I got. There was an error while trying to serialize parameter http://tateeda.com/2011/11:request. The InnerException message was &#8216;Type &#8216;System.Collections.Generic.List`1[[Tateeda.DomainModel.SystemModel.System, Tateeda.DomainModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]&#8217; with data contract name &#8216;ArrayOfMedication:http://schemas.datacontract.org/2004/07/Tateeda.DomainModel.SystemModel&#8217; is not expected. Consider [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tateeda.wordpress.com&amp;blog=24900017&amp;post=22&amp;subd=tateeda&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have run into issue with data serialization today.</p>
<p>I needed to update my very complex object by calling WCF services.</p>
<p>Here is the error I got.</p>
<p>There was an error while trying to serialize parameter http://tateeda.com/2011/11:request. The InnerException message was &#8216;Type &#8216;System.Collections.Generic.List`1[[Tateeda.DomainModel.SystemModel.System, Tateeda.DomainModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]&#8217; with data contract name &#8216;ArrayOfMedication:http://schemas.datacontract.org/2004/07/Tateeda.DomainModel.SystemModel&#8217; is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types &#8211; for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.&#8217;.  Please see InnerException for more details.</p>
<p>I got it to work, but there is a list to look for:</p>
<ol>
<li>Your class and all classes your class may based on have to have a [DataContract] and [DataMember]</li>
<li>Add all classes in base classes to list of known types [KnownType(typeof(Person))]</li>
<li>Make sure that you also decorate your Interface with ServiceKnownType</li>
</ol>
<div>Here is the example Request class:</div>
<div>
<pre>    [KnownType(typeof(MedicationSummary))]
    [KnownType(typeof(MedicationBase))]
    [KnownType(typeof(ComparableMedication))]
    [KnownType(typeof(Code))]
    [KnownType(typeof(Code.StatusCode))]
    [DataContract]
    public class MedicationRequest{
    [DataMember]
    public RequestDraft Medication{get;set;}
    }</pre>
</div>
<div>Known types above are referenced in RequestDraft object.</div>
<div>Interface decoration Example:</div>
<div>
<pre>    [ServiceKnownType(typeof(Code))]
    [ServiceKnownType(typeof(List&lt;Code&gt;))]
    public interface IMyService
    {
        [OperationContract]
        List&lt;string&gt; GetMedication(string[] codes);

        [OperationContract]
        AddSectionResponse AddSection(Section section);</pre>
<p>}</p>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tateeda.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tateeda.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tateeda.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tateeda.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tateeda.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tateeda.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tateeda.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tateeda.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tateeda.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tateeda.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tateeda.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tateeda.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tateeda.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tateeda.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tateeda.wordpress.com&amp;blog=24900017&amp;post=22&amp;subd=tateeda&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tateeda.wordpress.com/2011/07/26/wpf-wcf-list-serialization-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/862686305087c6809f0a548c04be47cc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tateeda</media:title>
		</media:content>
	</item>
		<item>
		<title>Return selected columns and join on more then one column with LINQ and EF 4.0</title>
		<link>http://tateeda.wordpress.com/2011/07/08/linq-ef-4-0-return-selected-columns-and-join-on-more-then-one-column/</link>
		<comments>http://tateeda.wordpress.com/2011/07/08/linq-ef-4-0-return-selected-columns-and-join-on-more-then-one-column/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 03:44:21 +0000</pubDate>
		<dc:creator>Tateeda.com</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[CLIRES-3]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[MVC 3]]></category>

		<guid isPermaLink="false">http://tateeda.wordpress.com/?p=15</guid>
		<description><![CDATA[I run today into specific need to return only selected columns from a table but also I had to join on more then one columns. In my case UnitOfWork is an Interface of tables something like this: IObjectSet&#60;Form&#62; Forms{get} On my UnitOfWork Interface look into Open Source CLIRES-3 at http://tateeda.com or http://clires3.codeplex.com Here what I got [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tateeda.wordpress.com&amp;blog=24900017&amp;post=15&amp;subd=tateeda&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre>I run today into specific need to return only selected columns from a table but also I had to join on more then one columns.
In my case UnitOfWork is an Interface of tables something like this:
IObjectSet&lt;Form&gt; Forms{get}

On my UnitOfWork Interface look into Open Source CLIRES-3 at <a title="Tateeda Media Newtork home (look for CLIRES-3)" href="http://tateeda.com" target="_blank">http://tateeda.com</a> or <a title="CLIRES-3 Open Source" href="http://clires3.codeplex.com" target="_blank">http://clires3.codeplex.com</a>
Here what I got Entity Framework 4.0 and LINQ....
var list = (from fa in UnitOfWork.FormAnswers
                        join q in UnitOfWork.Questions
                        on new { fa.QuestionId, fa.AnswerId } equals new { q.QuestionId, q.AnserId }
                        where q.FormId == formId &amp;&amp; fa.AppointmentFormId == appointementFormId
                        select new {
                            fa.Notes,
                            fa.FreeTextAnswer
                        }).ToList();</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tateeda.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tateeda.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tateeda.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tateeda.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tateeda.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tateeda.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tateeda.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tateeda.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tateeda.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tateeda.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tateeda.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tateeda.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tateeda.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tateeda.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tateeda.wordpress.com&amp;blog=24900017&amp;post=15&amp;subd=tateeda&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tateeda.wordpress.com/2011/07/08/linq-ef-4-0-return-selected-columns-and-join-on-more-then-one-column/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/862686305087c6809f0a548c04be47cc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tateeda</media:title>
		</media:content>
	</item>
		<item>
		<title>How to save SharePoint password for next time!</title>
		<link>http://tateeda.wordpress.com/2011/07/07/how-to-save-sharepoint-password-for-next-time/</link>
		<comments>http://tateeda.wordpress.com/2011/07/07/how-to-save-sharepoint-password-for-next-time/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 19:38:38 +0000</pubDate>
		<dc:creator>Tateeda.com</dc:creator>
				<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://tateeda.wordpress.com/?p=12</guid>
		<description><![CDATA[Steps on how to save your SharePoint password: Add the SharePoint site to the Local Intranet Zone in Internet Explorer. To do this, go to Tools &#62; Internet Options &#62; Security. In Local Intranet, click the Sites button and then Advanced. Add your SharePoint URL. Click Ok. Go to Start &#62; Control Panel &#62; User Accounts &#62; Credential Manger &#62; Generic Credentials &#62; Add [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tateeda.wordpress.com&amp;blog=24900017&amp;post=12&amp;subd=tateeda&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Steps on how to save your SharePoint password:</p>
<ol>
<li>Add the SharePoint site to the Local Intranet Zone in Internet Explorer. To do this, go to <strong>Tools &gt; Internet Options &gt; Security</strong>. In <strong>Local Intranet,</strong> click the <strong>Sites</strong> button and then <strong>Advanced</strong>.</li>
<li>Add your SharePoint URL. Click <strong>Ok</strong>.</li>
<li>Go to <strong>Start</strong> &gt; <strong>Control Panel &gt; User Accounts &gt; Credential Manger &gt; Generic Credentials &gt; Add a Generic Credential</strong></li>
<li>Enter your site http<strong>s://</strong>sharepoint.yoursite.com<strong> user name </strong>with domain<strong> mydomain\username </strong></li>
<li>Enter your password and click <strong>OK</strong>.</li>
<li>Log out</li>
<li>Log in again</li>
</ol>
<div>Works for me on Windows 7 and SharePoint 2010</div>
<p><span style="font-size:small;"><span class="Apple-style-span" style="line-height:normal;"><br />
</span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tateeda.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tateeda.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tateeda.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tateeda.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tateeda.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tateeda.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tateeda.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tateeda.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tateeda.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tateeda.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tateeda.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tateeda.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tateeda.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tateeda.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tateeda.wordpress.com&amp;blog=24900017&amp;post=12&amp;subd=tateeda&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tateeda.wordpress.com/2011/07/07/how-to-save-sharepoint-password-for-next-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/862686305087c6809f0a548c04be47cc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tateeda</media:title>
		</media:content>
	</item>
	</channel>
</rss>
