Permalink
Browse files

setup the readme file

  • Loading branch information...
1 parent fb2bd9b commit 63eed3c1864d1bc484da232ab3c7aef8ce829600 @DannyDouglass committed Nov 9, 2010
@@ -2,7 +2,7 @@
{
public interface ITweetContract
{
- ulong Id { get; set; } // id is larger than an int32 can handle
+ ulong Id { get; set; }
string Name { get; set; }
string UserName { get; set; }
string Body { get; set; }
@@ -12,25 +12,31 @@ public static void CreateTweetXmlMap()
Mapper.CreateMap<XElement, ITweetContract>()
.ForMember(
dest => dest.Id,
- options => options.ResolveUsing<XElementResolver<ulong>>().FromMember(source => source.Element("id")))
+ options => options.ResolveUsing<XElementResolver<ulong>>()
+ .FromMember(source => source.Element("id")))
.ForMember(
dest => dest.Name,
- options => options.ResolveUsing<XElementResolver<string>>().FromMember(
- source => source.Element("user").Descendants("name").Single()))
+ options => options.ResolveUsing<XElementResolver<string>>()
+ .FromMember(source => source.Element("user")
+ .Descendants("name").Single()))
.ForMember(
dest => dest.UserName,
- options => options.ResolveUsing<XElementResolver<string>>().FromMember(
- source => source.Element("user").Descendants("screen_name").Single()))
+ options => options.ResolveUsing<XElementResolver<string>>()
+ .FromMember(source => source.Element("user")
+ .Descendants("screen_name").Single()))
.ForMember(
dest => dest.Body,
- options => options.ResolveUsing<XElementResolver<string>>().FromMember(source => source.Element("text")))
+ options => options.ResolveUsing<XElementResolver<string>>()
+ .FromMember(source => source.Element("text")))
.ForMember(
dest => dest.ProfileImageUrl,
- options => options.ResolveUsing<XElementResolver<string>>().FromMember(
- source => source.Element("user").Descendants("profile_image_url").Single()))
+ options => options.ResolveUsing<XElementResolver<string>>()
+ .FromMember(source => source.Element("user")
+ .Descendants("profile_image_url").Single()))
.ForMember(
dest => dest.Created,
- options => options.ResolveUsing<XElementResolver<string>>().FromMember(source => source.Element("created_at")));
- }
+ options => options.ResolveUsing<XElementResolver<string>>()
+ .FromMember(source => source.Element("created_at")));
+ }
}
}
@@ -5,7 +5,8 @@ namespace AutoMapperXmlDemo.Web.Controllers
{
public class HomeController : Controller
{
- private TwitterTimelineRetriever _twitterTimelineRetriever;
+ private TwitterTimelineRetriever _twitterTimelineRetriever;
+
public ActionResult Index()
{
_twitterTimelineRetriever = new TwitterTimelineRetriever();
View
@@ -0,0 +1,7 @@
+[View Details on my Blog Post](http://DannyDouglass.com/2010/11/simplify-using-xml-data-with-automapper-and-linqtoxml)
+
+This demo is intended to show one way that [AutoMapper](https://github.com/jbogard/AutoMapper) can be utilized to ease the use of Xml data in a strongly-typed, testable manner.
+
+A sample MVC3 website is included that displays the Twitter Public Timeline using AutoMapper and Linq-to-Xml to faciliate retrieval of the twitter timeline xml data.
+
+[AutoMapper](https://github.com/jbogard/AutoMapper) is a convention based object-object mapper. You can read more about AutoMapper on the [CodePlex Project Page](http://automapper.codeplex.com/).

0 comments on commit 63eed3c

Please sign in to comment.