Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Fluent Interface and AutoMap #75

Open
jagregory opened this issue Jul 21, 2011 · 1 comment
Open

Merge Fluent Interface and AutoMap #75

jagregory opened this issue Jul 21, 2011 · 1 comment
Labels
Milestone

Comments

@jagregory
Copy link
Collaborator

Merge the Fluent Interface and AutoMappings into one awesome mapping.

What I envision is inspired by StructureMap. Something like the PersistenceModel is equatable to the Repository in StructureMap, where you supply it with mappings (analogous to types). Mappings can be supplied either as instances (or by type) or they can be automapped (analogous to Scanning).

public class MyPersistenceModel : PersistenceModel
{
  protected override void Initialise()
  {
    ForType<Person>
      .UseMapping<PersonMap>();

    ForTypes
      .InNamespace("My.Entities")
      .UseMappingsInNamespace("My.Mappings");

    ForTypes
      .InNamespace("My.SimpleEntities")
      .AutoMap();

    ForType<Product>
      .AutoMap();
  }
}

public class PersonMap : ClassMap<Person>
{
  protected override Initialise()
  {
    DiscoverDefaults();

    Map(x => x.Name)
      .ColumnName("PersonName");
  }
}

This ticket should be separated closer to the time of development!

@firo222
Copy link
Contributor

firo222 commented Dec 6, 2012

is this still wanted? IMO this ticket can be closed because there is already an API for defining mappins with the .Mappings() extension method for Configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants