Created
April 27, 2009 22:29
-
-
Save KevM/102786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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