Skip to content

Instantly share code, notes, and snippets.

@KevM
Created April 27, 2009 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KevM/102786 to your computer and use it in GitHub Desktop.
Save KevM/102786 to your computer and use it in GitHub Desktop.
public class SolutionMap : DataMap<Solution>
{
protected override void MapDefinition()
{
FromTable("probdesc")
.Assign(d => d.ID).FromIdentifyingField("id_number")
.Assign(d => d.Title).FromField("title")
.Assign(d => d.Created).FromField("creation_time")
.Assign(d => d.DatabaseIdentifier).FromField("objid")
.Assign(d => d.MultiField).FromFields("objid", "title")
.Assign(d => d.IsPublic).WithField("public_ind").Do(isPublic => isPublic == "1")
.Assign(d => d.IntFromFunction).With(() => ExpectedFromFunctionDateTime.Hour)
.MapMany<Resolution>().To(d => d.Resolutions).ViaRelation("probdesc2workaround", resolution =>
{
resolution.Assign(d => d.Created).FromField("creation_time");
resolution.Assign(d => d.Description).FromField("description");
});
}
}
public class Resolution
{
public string Description { get; set; }
public DateTime Created { get; set; }
}
public class Solution
{
public int DatabaseIdentifier { get; set; }
public string ID { get; set; }
public DateTime Created { get; set; }
public string Title { get; set; }
public string MultiField { get; set; }
public bool IsPublic { get; set; }
public int IntFromFunction { get; set; }
public Resolution[] Resolutions { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment