<?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>Antonio Di Motta</title>
	<atom:link href="https://dimotnet.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://dimotnet.wordpress.com</link>
	<description>&#34;Any fool can write code that a computer can understand. Good programmers write code that humans can understand.&#34; (Martin Fowler)</description>
	<lastBuildDate>Wed, 02 Nov 2016 19:47:52 +0000</lastBuildDate>
	<language>it-IT</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dimotnet.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://secure.gravatar.com/blavatar/6568c6750e8a900d2c08bd45b35fdcc6?s=96&#038;d=https%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Antonio Di Motta</title>
		<link>https://dimotnet.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://dimotnet.wordpress.com/osd.xml" title="Antonio Di Motta" />
	<atom:link rel='hub' href='https://dimotnet.wordpress.com/?pushpress=hub'/>
	<item>
		<title>Entity Framework custom configuration</title>
		<link>https://dimotnet.wordpress.com/2012/03/16/entity-framework-custom-configuration/</link>
		<comments>https://dimotnet.wordpress.com/2012/03/16/entity-framework-custom-configuration/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 13:52:42 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[custom configuration]]></category>
		<category><![CDATA[DbContext]]></category>
		<category><![CDATA[domain objects]]></category>
		<category><![CDATA[ef]]></category>
		<category><![CDATA[entityframework]]></category>
		<category><![CDATA[EntityTypeConfiguration]]></category>
		<category><![CDATA[mapping]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=402</guid>
		<description><![CDATA[With EF Code-First it&#8217;s easy create a database starting from domain objects, but it&#8217;s always possible create an our custom configuration. In my project I have two class, Role and User: public class Role { public Guid Id { get; set; } public string Name { get; set; } } public class User { IList&#60;Role&#62; [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=402&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>With <a href="http://msdn.microsoft.com/en-us/data/aa937723" target="_blank">EF Code-First</a> it&#8217;s easy create a database starting from domain objects,<br />
but it&#8217;s always possible create an <strong>our custom configuration</strong>.</p>
<p>In my project I have two class, Role and User:</p>
<pre>public class Role
{
    public Guid Id { get; set; }
    public string Name { get; set; }
}

public class User
{
     IList&lt;Role&gt; _role;

     public virtual IList&lt;Role&gt; Roles
     {
        get { return _role ?? ( _role = new List&lt;Role&gt;() ); }
     }

     public Guid Id { get; set; }

     public string UserName{ get; set; }
     public string FirstName { get; set; }
     public string LastName { get; set; }
}</pre>
<p>If you want create custom configuration for User and Role, you can write others two class that works as configuration,   <strong>RoleConfigration </strong>and <strong>UserConfiguration</strong> that extend <a href="http://msdn.microsoft.com/en-us/library/gg696117(v=vs.103).aspx" target="_blank">EntityTypeConfiguration</a>:</p>
<pre>// custom configuration for Role
public class RoleConfiguration : <strong>EntityTypeConfiguration</strong>&lt;Role&gt;
{
     public RoleMapping()
     {
         ToTable( "Roles" ); // ef will create a table with name Roles
         HasKey(o =&gt; o.Id);  // define a key
         Property( o =&gt; o.Name ).IsRequired(); // this property is required on repository
     }
}

// custom configuration for User
public class UserConfiguration : <strong>EntityTypeConfiguration</strong>&lt;User&gt;
{
    public UserMapping()
    {
         ToTable( "Users" ); // ef will create a table with name Users
         
         HasKey(o =&gt; o.Id);  // define a key
         // the property is required on repository
         Property( o =&gt; o.UserName ).IsRequired(); 
         // this property is nullable and map on column with name firstname
         Property( o =&gt; o.FirstName ).HasColumnName("firstname");
         // this property is nullable and map on column with name lastname
         Property( o =&gt; o.LastName ).HasColumnName("lastname"); 

         // configure many-to-many navigation property between
         // User and Role
         HasMany( o =&gt; o.Roles ).WithMany();
    }
}</pre>
<p>
Now, for use our custom configuration, we will simply add RoleConfiguration and UserConfiguration to <strong>DbContext</strong>:</p>
<pre>public class MyDbContext : DbContext
{
    public virtual IDbSet CreateSet()
         where TEntity : class
    {
        return Set();
    }

    protected override void <strong>OnModelCreating</strong>( DbModelBuilder modelBuilder )
    {
        modelBuilder.Configurations.Add( <strong>new RoleConfiguration()</strong> );
        modelBuilder.Configurations.Add( <strong>new UserConfiguration()</strong> );

        base.OnModelCreating( modelBuilder );
    }
}</pre>
<p>Hope this helps,<br />
Tony</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/402/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/402/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=402&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2012/03/16/entity-framework-custom-configuration/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
		<item>
		<title>Message Context System</title>
		<link>https://dimotnet.wordpress.com/2012/02/08/message-context-system/</link>
		<comments>https://dimotnet.wordpress.com/2012/02/08/message-context-system/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 11:46:50 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[mcs]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=356</guid>
		<description><![CDATA[Ancora oggi lo strumento per comunicare più utilizzato nelle organizzazioni è la posta elettronica. Si proprio lei la nostra cara &#8220;vecchia email&#8221; gioie e dolori di molti dipendenti. Trovare decine di email da leggere, nella propria casella di posta, può far perdere molto tempo, anche perché molte sono li per  eccesso di scrupolo  da parte di [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=356&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Ancora oggi lo strumento per comunicare più utilizzato nelle organizzazioni è la posta elettronica.</p>
<p>Si proprio lei la nostra cara &#8220;vecchia email&#8221; gioie e dolori di molti dipendenti.</p>
<p>Trovare decine di email da leggere, nella propria casella di posta, può far perdere molto tempo, anche perché molte sono li per<em>  eccesso di scrupolo </em> da parte di chi le ha inviate, <em>tanto una email in più non fa mai male</em><img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>
<p>Questo<em> spam a fin di bene </em> <strong>è principalmente un problema organizzativo</strong> e gli effetti dannosi di tale pratica sono direttamente proporzionali alla dimensione delle organizzazioni stesse.</p>
<p>Occorrerebbe forzare le persone a pensare prima di inviare una mail, rispondendo ad una domanda del tipo:</p>
<blockquote><p><strong>Qual è il contesto informativo a cui si rivolge questa mail?</strong></p></blockquote>
<p>Rispondere a questa domanda può non essere semplice, per questo ho iniziato a lavorare ad una progetto software il cui obiettivo è quello di migliorare il modo con cui avviene la comunicazione all&#8217;interno di una organizzazione.</p>
<p>L’idea di base è quello di <strong>contestualizzare i messaggi</strong> che il mittente invia senza dover dichiarare esplicitamente i diretti destinatari degli stessi, ma piuttosto di indicare <em>di cosa tratta il messaggio</em> che stiamo inviando.<br />
Un messaggio così fatto sarà inviato ad un servizio software il quale, in base alle informazioni in suo possesso, deciderà chi sono i destinatari.</p>
<p>Un esempio di nuovo messaggio può chiarire l&#8217;idea:</p>
<blockquote><p>from: Antonio Di Motta<br />
to: <strong>&lt;myorg&gt;.process.new</strong><br />
message body:<br />
La presente è per informarvi che è stato rilasciato un nuovo processo aziendale relativo alla gestione delle stampanti aziendali&#8230;</p></blockquote>
<p>Il servizio software avrà a disposizione un indice interno del tipo:</p>
<blockquote><p>&lt;myorg&gt;.process.* =&gt; employee1, employee2<br />
&lt;myorg&gt;.process.new =&gt; employee3<br />
&lt;myorg&gt;.process.change =&gt; employee4<br />
&#8230;&#8230;.</p></blockquote>
<p>Dopo aver consultato l’indice, il messaggio verrà inoltrato ad employee1, employee2 e employee3, ma non ad employee4 in quanto risulta interessato solo ai cambiamenti dei processi aziendali già presenti.</p>
<p>Un software di questo tipo può essere classificato come <strong>Message Context System (MCS)</strong> e garantisce l’invio solo dell’email necessarie, in quanto costringerebbe gli autori a riflettere su quale sia l’ambito informativo da considerare e di conseguenza <strong> imporre una organizzazione alle comunicazioni interne</strong>.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/356/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=356&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2012/02/08/message-context-system/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
		<item>
		<title>Entity Framework database initialization</title>
		<link>https://dimotnet.wordpress.com/2012/01/24/entity-framework-database-initialization/</link>
		<comments>https://dimotnet.wordpress.com/2012/01/24/entity-framework-database-initialization/#respond</comments>
		<pubDate>Tue, 24 Jan 2012 14:57:05 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[codefirst]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[ef]]></category>
		<category><![CDATA[entityframework]]></category>
		<category><![CDATA[intialize]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=293</guid>
		<description><![CDATA[With version 4.1 or later Entity Framework provides a useful way for recreate and optionally re-seed the database with data the first time or before the execution of unit test. For this purpose Microsoft provides some classes: CreateDatabaseIfNotExists DropCreateDatabaseAlways DropCreateDatabaseIfModelChanges All classes implement interface IDatabaseInitializer&#60;T&#62; where T is a DbContext. For example if you want [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=293&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>With version 4.1 or later <a href="http://msdn.microsoft.com/en-us/library/bb399567.aspx" target="_blank">Entity Framework</a> provides a useful way for recreate and optionally re-seed the database with data the first time or before the execution of unit test.</p>
<p>For this purpose Microsoft provides some classes:</p>
<ul>
<li>CreateDatabaseIfNotExists</li>
<li>DropCreateDatabaseAlways</li>
<li>DropCreateDatabaseIfModelChanges</li>
</ul>
<p>All classes implement interface <strong>IDatabaseInitializer&lt;T&gt;</strong> where T is a <a href="http://msdn.microsoft.com/en-us/library/system.data.entity.dbcontext(v=VS.103).aspx" target="_blank">DbContext</a>.</p>
<p>For example if you want populate database with base informations before execute<br />
an unit test you can write code like this:</p>
<pre>public class MyTestIntializer : <strong>DropCreateDatabaseAlways</strong>&lt;MyContext&gt;
{
  protected override void Seed( MyContext context )
  {
      var categories = new Lists&lt;Category&gt;();
      var products = new Lists&lt;Product&gt;();

      categories.Add( new Category { Name = "tech" } );
      categories.Add( new Category { Name = "food" } );

      products.Add( new Product { Name = "cpu", Category = categories[0] } );
      products.Add( new Product { Name = "harddisk",
                          Category = categories[0] } );
      products.Add( new Product { Name = "biscuits",
                          Category = categories[1] } );

      addToContext&lt;Category&gt;( context, categories );
      addToContext&lt;Product&gt;( context, products );
  }

  private void addToContext&lt;T&gt;( MyContext context, IList collection )
  {
      foreach( var item in collection )
      {
          context.Set&lt;T&gt;().Add( item );
      }
   }
}</pre>
<p>This data initializer drop (if exists) and create database and finally populate it with<br />
categories and products.</p>
<p>Now we can add it to our test class.</p>
<pre>
[ClassInitialize()]
public static void MyClassInitialize( TestContext testContext )
{
    Database.SetInitializer&lt;MyContext&gt;( new <strong>MyTestIntializer</strong>() );
}
</pre><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/293/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=293&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2012/01/24/entity-framework-database-initialization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
		<item>
		<title>Autofac Dependency resolution with ASP.NET MVC</title>
		<link>https://dimotnet.wordpress.com/2012/01/18/autofac-dependency-resolution-with-asp-net-mvc/</link>
		<comments>https://dimotnet.wordpress.com/2012/01/18/autofac-dependency-resolution-with-asp-net-mvc/#respond</comments>
		<pubDate>Wed, 18 Jan 2012 13:52:00 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[asp net]]></category>
		<category><![CDATA[autofac]]></category>
		<category><![CDATA[di]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[ioc]]></category>
		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=256</guid>
		<description><![CDATA[The current version of ASP.NET MVC (release 3) supports a new IDependencyResolver interface that makes it easier to integrate DI frameworks. For instance, if you are using AutoFac you can write code like this: public class AutoFacDependencyResolver : IDependencyResolver { readonly IContainer _container; public AutoFacDependencyResolver ( ContainerBuilder builder ) { this._container = builder.Build(); } public [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=256&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The current version of <a href="http://www.asp.net/mvc">ASP.NET MVC</a> (release 3) supports a new <strong><a href="http://msdn.microsoft.com/it-it/library/gg401972(v=vs.98).aspx">IDependencyResolver</a></strong> interface that makes it easier to integrate DI frameworks.</p>
<p>For instance, if you are using <a href="http://code.google.com/p/autofac/" target="_blank">AutoFac</a> you can write code like this:</p>
<pre>public class AutoFacDependencyResolver : IDependencyResolver
{
   readonly IContainer _container;
   public AutoFacDependencyResolver ( ContainerBuilder builder )
   {
      this._container = builder.Build();
   }
   public object GetService( Type serviceType )
   {
      try
      {
         return _container.Resolve( serviceType );
      }
      catch { return null; }
   }

   public IEnumerable GetServices( Type serviceType )
   {
      try
      {
         var enumerableType = typeof( IEnumerable ).MakeGenericType( serviceType );
         return _container.Resolve( enumerableType ) as IEnumerable;
      }
      catch { return null; }
   }
}</pre>
<p>Now, it&#8217;s easy to register your types and what should resolver use:</p>
<pre>protected void Application_Start()
{
   // register type
   var containerBuilder = new ContainerBuilder();
   containerBuilder.RegisterType&lt;MyConcreteClass&gt;().As&lt;IMYInterface&gt;();

   // set resolver
   DependencyResolver.SetResolver(
      new AutoFacDependencyResolver( containerBuilder ) );
}</pre><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/256/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=256&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2012/01/18/autofac-dependency-resolution-with-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
		<item>
		<title>MongoLab Rest Client</title>
		<link>https://dimotnet.wordpress.com/2012/01/05/mongolab-rest-client/</link>
		<comments>https://dimotnet.wordpress.com/2012/01/05/mongolab-rest-client/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 16:29:02 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[mongolab]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=244</guid>
		<description><![CDATA[I love build ASP.NET MVC projects using C# for this reason I&#8217;m searching an inexpensive way for publish my web projects using PaaS approach. After this search I choose AppHarbor solution for host application but for storage I wanted to experiment a Nosql database because I like flexibility of schema feature and there are many [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=244&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I love build ASP.NET MVC projects using C# for this reason I&#8217;m searching an inexpensive way for publish my web projects using <a href="http://en.wikipedia.org/wiki/Platform_as_a_service" target="_blank">PaaS</a> approach. After this search I choose <a href="https://appharbor.com" target="_blank">AppHarbor</a> solution for host application but for storage I wanted to experiment a Nosql database because I like flexibility of schema feature and there are many free solutions in internet.<br />
I found MongoLab a cloud MongoDB hosting that provide 240MB without costs. The main way for access to mongodb database on <a href="https://mongolab.com/home" title="MongoLab" target="_blank">mongolab</a> are rest api very simple to use, but I&#8217;m .net developer so I created a small library for manage database using only C# classes. I called it <a href="https://github.com/antdimot/MongoLab-Rest-Client" target="_blank">MongoLab-Rest-Client</a> and I release it on GitHub (yes I wanted try also git<img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> ).</p>
<p>What can we do with MongoLab-Rest-Client? Today all crud operations on our entities.</p>
<p>Steps:<br />
1) Sign up to <a href="http://mongolab.com">http://mongolab.com</a><br />
2) Get the apikey ( ex. 123456789012345678901234 )<br />
3) Write code:</p>
<p>var client = new MRestClient( &#8220;mydb&#8221; );<br />
client.Apikey = &#8220;12345678901234567890123&#8221;;</p>
<p>// store a new entity<br />
var obj = new Product();<br />
var result = client.Create( obj );</p>
<p>// make a query using criteria api<br />
var criteria = new Criteria();<br />
criteria.Add( Restriction.Or<br />
		.Add( Restriction.Eq( &#8220;Name&#8221;, &#8220;name1&#8221; ) )<br />
		.Add( Restriction.Eq( &#8220;Name&#8221;, &#8220;name2&#8221; ) ) )<br />
        .Add( Restriction.Lte( &#8220;Quantity&#8221;, 2 ) );<br />
IList products = client.GetByCriteria( criteria );</p>
<p>Only easy C# code and without define a schema on database.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/244/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=244&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2012/01/05/mongolab-rest-client/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
		<item>
		<title>ALTernative Paas a Windows Azure</title>
		<link>https://dimotnet.wordpress.com/2011/12/22/alternative-paas-a-windows-azure/</link>
		<comments>https://dimotnet.wordpress.com/2011/12/22/alternative-paas-a-windows-azure/#respond</comments>
		<pubDate>Thu, 22 Dec 2011 08:24:22 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[asp net]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[paas]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=231</guid>
		<description><![CDATA[Per chi sviluppa con .Net e vuole provare a fare qualcosa con il cloud sicuramente la prima scelta è Windows Azure, ma io ultimamente mi sento molto ALT.NET e allora ho deciso di cercare qualche altra soluzione PaaS (Platform As A Service) magari a prezzi più bassi, ed ho trovato AppHarbor. AppHarbor gestisce sia il [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=231&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Per chi sviluppa con .Net e vuole provare a fare qualcosa con il cloud sicuramente la prima scelta è <a href="http://www.windowsazure.com">Windows Azure</a>, ma io ultimamente mi sento molto <a href="http://ugialt.net">ALT.NET</a> e allora ho deciso di cercare qualche altra soluzione <a href="http://en.wikipedia.org/wiki/Platform_as_a_service">PaaS</a> (Platform As A Service) magari a prezzi più bassi, ed ho trovato <a href="https://appharbor.com">AppHarbor</a>.</p>
<p>AppHarbor gestisce sia il deployment che la fase di runtime delle applicazioni .net.<br />
E&#8217; possibile fare il push del codice, in pratica, da tutti i vcs e dvcs oggi disponibili (git, mercurial, svn, tfs&#8230;), AppHarbor farà la build, lancerà i nostri test e se questi daranno esito positivo farà il deployment sull&#8217;application server e noi sviluppatori riceveremo tutte le notifiche.</p>
<p>In fase di esecuzione AppHarbor gestirà la scalabilità dell&#8217;applicazione (possiamo acquistare più istanze) e il bilanciamento del carico delle richieste.</p>
<p>Una caratteristiche che mi piace molto è l&#8217;estendibilità della piattaforma, in quanto AppHarbor mette a disposizione delle api per consentirci di sviluppare nuovi add-on come ad esempio supportare un nuovo vcs o un nuovo sistema di notifiche.</p>
<p>Una chicca è il catalogo degli <a href="https://appharbor.com/addons">add-on</a> (in continua crescita) per &#8220;pluggare&#8221; servizi nelle nostre applicazioni come dbms (sqlserver,mysql,mongodb,redis) o gestiori di log (airbrake), un vero e proprio store di servizi per le applicazioni.</p>
<p>Per chi vuole cominciare a provarlo <a href="https://appharbor.com/page/pricing">i prezzi</a> mi sembrano competitivi e la prima istanza è gratis.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/231/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=231&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2011/12/22/alternative-paas-a-windows-azure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
		<item>
		<title>When the model is legacy.</title>
		<link>https://dimotnet.wordpress.com/2011/12/20/when-the-model-is-legacy/</link>
		<comments>https://dimotnet.wordpress.com/2011/12/20/when-the-model-is-legacy/#respond</comments>
		<pubDate>Tue, 20 Dec 2011 11:02:48 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[automapper]]></category>
		<category><![CDATA[dto]]></category>
		<category><![CDATA[mapper]]></category>
		<category><![CDATA[model]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=202</guid>
		<description><![CDATA[I started a new Asp.Net MVC project with an existing domain model and DAL logic. Unfortunately &#8220;the legacy domain model&#8221; was made for different data access logic (client-server) while I need to show to show information in a different way. Searching an easy solution to adapt old logic (Building) to new logic (BuildingDTO) presentation I [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=202&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I started a new Asp.Net MVC project with an existing domain model and DAL logic. Unfortunately &#8220;the legacy domain model&#8221; was made for different data access logic (client-server) while I need to show to show information in a different way.<br />
Searching an easy solution to adapt old logic (Building) to new logic (BuildingDTO) presentation I found <em>Aftermap </em>method of <a title="Automapper" href="http://automapper.org/" target="_blank">Automapper</a>.<br />
Below the code that I wrote:</p>
<pre>namespace LegacyDomain
{
 public class Building
 {
   public int Id { get; set; }
   public IList Resources { get; set; }
   //.....
 }

 public class Resource
 {
   public int Id { get; set; }
   public byte[] Bytes { get; set; }
   public ResourceType RType { get; set; }
  }

  public enum ResourceType { SmallPhoto, BigPhoto }
}

namespace DTO
{
 public class BuildingDTO
 {
   public int Id { get; set; }
   public int SmallPhotoId { get; set; }
   public int BigPhotoId { get; set; }
 }
}

Mapper.CreateMap()
      .<strong>AfterMap</strong>( ( i, d ) =&gt; d.SmallPhotoId = i.Resources
         .Where( r =&gt; r.RType == ResourceType.SmallPhoto )
         .Select( r =&gt; r.Id ).SingleOrDefault() )
      .<strong>AfterMap</strong>( ( i, d ) =&gt; d.BigPhotoId = i.Resources
         .Where( r =&gt; r.RType == ResourceType.BigPhoto )
         .Select( r =&gt; r.Id ).SingleOrDefault() )</pre><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/202/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=202&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2011/12/20/when-the-model-is-legacy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
		<item>
		<title>EF 4.1 &#8211; OnModelCreating</title>
		<link>https://dimotnet.wordpress.com/2011/06/18/ef-4-1-onmodelcreating/</link>
		<comments>https://dimotnet.wordpress.com/2011/06/18/ef-4-1-onmodelcreating/#respond</comments>
		<pubDate>Sat, 18 Jun 2011 14:40:20 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[codefirst]]></category>
		<category><![CDATA[entityframework]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=182</guid>
		<description><![CDATA[Sebbene EF 4.1 si preoccupa di generare il database per noi, abbiamo ancora la possibilità di gestire come questo debba essere strutturato (nomi delle tabelle, chiavi primarie, tipi delle colonne ecc..). Per intervenire su questi aspetti ci basterà fare l&#8217;override del metodo OnModelCreating del nostro DbContext: public class ADMDbContext : DbContext { public DbSet&#60;User&#62; Users [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=182&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Sebbene EF 4.1 si preoccupa di generare il database per noi, abbiamo ancora la possibilità di gestire come questo debba essere strutturato (nomi delle tabelle, chiavi primarie, tipi delle colonne ecc..).</p>
<p>Per intervenire su questi aspetti ci basterà fare l&#8217;override del metodo OnModelCreating del nostro DbContext:</p>
<pre>public class ADMDbContext : <strong>DbContext</strong>
{
        public DbSet&lt;User&gt; Users { get; set; }
        public DbSet&lt;Role&gt; Roles { get; set; }

        protected override void <strong>OnModelCreating</strong>( DbModelBuilder modelBuilder )
        {
            modelBuilder.Entity&lt;User&gt;().ToTable( "Users" );

            modelBuilder.Entity&lt;User&gt;().HasKey( o =&gt; o.Id );
            modelBuilder.Entity&lt;User&gt;().Property( o =&gt; o.UserName ).IsRequired();

            modelBuilder.Entity&lt;Role&gt;().HasKey( o =&gt; o.Id );
            modelBuilder.Entity&lt;Role&gt;().Property( o =&gt; o.Name ).IsRequired();

            base.OnModelCreating( modelBuilder );
        }
}</pre><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/182/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=182&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2011/06/18/ef-4-1-onmodelcreating/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
		<item>
		<title>Entity Framework 4.1 &#8211; Introduzione alle novità</title>
		<link>https://dimotnet.wordpress.com/2011/06/08/entity-framework-4-1-introduzione-alle-novita/</link>
		<comments>https://dimotnet.wordpress.com/2011/06/08/entity-framework-4-1-introduzione-alle-novita/#respond</comments>
		<pubDate>Wed, 08 Jun 2011 14:11:10 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[codefirst]]></category>
		<category><![CDATA[entityframework]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=169</guid>
		<description><![CDATA[Devo ammetterlo la nuova versione di EF la 4.1 mi sta piacendo molto, certo il team di EF ha ancora molto lavoro da fare per raggiungere il livello di NHibernate, il quale rimane ancora oggi il miglior ORM per chi vuol sviluppare con la piattaforma .NET, ma sono sulla strada giusta. La versione 4.1 di [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=169&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Devo ammetterlo la nuova versione di <a href="http://msdn.microsoft.com/en-us/data/aa937723">EF la 4.1</a> mi sta piacendo molto, certo il team di EF ha ancora molto lavoro da fare per raggiungere il livello di <a title="NHibernate" href="http://www.nhforge.org">NHibernate</a>, il quale rimane ancora oggi il miglior ORM per chi vuol sviluppare con la piattaforma .NET, ma sono sulla strada giusta.</p>
<p>La versione 4.1 di EF, introduce il nuovo modello di sviluppo <em>code-first</em>, che si affianca alle altre due modalità <em>model-first</em> e <em>database-first</em>, già presenti nella precedente versione.<br />
Personalmente trovo il nuovo approccio code-first più vicino al mio modo di sviluppare codice, in quanto ho delle preferenze per lo sviluppo DDD (Domain Driven Development).</p>
<p>In pratica la prima cosa che faccio quando inizio un nuovo progetto è quello di definire le entità che meglio modellano lo scenario (attraverso la scrittura di classi C#) in cui dovrà operare l&#8217;applicazione che dovrò realizzare, senza dovermi preoccupare (inizialmente) di come queste debbano essere persistite. Dal punto di vista del codice.</p>
<p><code>public class User<br />
{<br />
public int Id { get; set; }<br />
public string FirstName { get; set; }<br />
public string LastName { get; set; }<br />
public string Email { get; set; }<br />
}</code></p>
<p>L&#8217;unico overhead aggiunto da EF 4.1 è la definizione di una classe che estenderà DbContext, la quale rappresenta in punto d&#8217;ingresso per gestire la persistenza delle entità. Ad esempio:</p>
<p><code>public class MyContext : <strong>DbContext</strong><br />
{<br />
public DbSet&lt;User&gt; Users { get; set; }<br />
}</code><br />
<strong>Finito!</strong></p>
<p>Nessun database creato, nessuna tabella definita.</p>
<p>Adesso ci basterà scrivere una normale query Linq per recupare i dati dal database:</p>
<p><em>var ctx = new MyContext();</em></p>
<p>var query = from o in ctx.Users select o;</p>
<p>var users = query.<strong>ToList();</strong></p>
<p>Cosa è successo?</p>
<p>Semplicemente (si fa per dire), al momento dell&#8217;esecuzione del metodo <strong>ToList()</strong> il motore di EntityFramework genererà per noi un database (sql server) con il nome <strong>MyContext</strong> e le tabelle necessarie a persistere le classi definite come DbSet nella classe MyContext, infone verrà effettuata la query T-Sql generata dal provider Linq dell&#8217;Entity Framework.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/169/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=169&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2011/06/08/entity-framework-4-1-introduzione-alle-novita/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
		<item>
		<title>NHDay Introduction to LINQ2NH</title>
		<link>https://dimotnet.wordpress.com/2010/11/01/nhday-introduction-to-linq2nh/</link>
		<comments>https://dimotnet.wordpress.com/2010/11/01/nhday-introduction-to-linq2nh/#respond</comments>
		<pubDate>Mon, 01 Nov 2010 20:17:42 +0000</pubDate>
		<dc:creator><![CDATA[Antonio Di Motta]]></dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[nhibernate]]></category>

		<guid isPermaLink="false">http://dimotnet.wordpress.com/?p=153</guid>
		<description><![CDATA[<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=153&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div class="jetpack-video-wrapper"><iframe src='https://www.slideshare.net/slideshow/embed_code/5412508' width='1008' height='826' allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dimotnet.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dimotnet.wordpress.com/153/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=dimotnet.wordpress.com&#038;blog=11799624&#038;post=153&#038;subd=dimotnet&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://dimotnet.wordpress.com/2010/11/01/nhday-introduction-to-linq2nh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72916097c8985125323d0fbd5f29510b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">antdimot</media:title>
		</media:content>
	</item>
	</channel>
</rss>
