public void Version <TProperty>(Expression <Func <TEntity, TProperty> > versionProperty, Action <IVersionMapper> versionMapping) { MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(versionProperty); ExplicitDeclarationsHolder.AddAsVersionProperty(member); CustomizersHolder.AddCustomizer(typeof(TEntity), (IClassMapper m) => m.Version(member, versionMapping)); }
protected override void RegisterMapMapping <TKey, TElement>(Expression <Func <TEntity, IDictionary <TKey, TElement> > > property, Action <IMapPropertiesMapper <TEntity, TKey, TElement> > collectionMapping, Action <IMapKeyRelation <TKey> > keyMapping, Action <ICollectionElementRelation <TElement> > mapping) { MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property); ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member)); base.RegisterMapMapping(property, collectionMapping, keyMapping, mapping); }
public void Version(string notVidiblePropertyOrFieldName, Action <IVersionMapper> versionMapping) { var member = typeof(TEntity).GetPropertyOrFieldMatchingName(notVidiblePropertyOrFieldName); ExplicitDeclarationsHolder.AddAsVersionProperty(member); CustomizersHolder.AddCustomizer(typeof(TEntity), (IClassMapper m) => m.Version(member, versionMapping)); }
protected override void RegisterNoVisiblePropertyMapping(string notVisiblePropertyOrFieldName, System.Action <IPropertyMapper> mapping) { MemberInfo member = typeof(TEntity).GetPropertyOrFieldMatchingName(notVisiblePropertyOrFieldName); ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member)); base.RegisterNoVisiblePropertyMapping(notVisiblePropertyOrFieldName, mapping); }
protected override void RegisterComponentMapping <TComponent>(Expression <Func <TEntity, TComponent> > property, Action <IComponentMapper <TComponent> > mapping) { MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property); ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member)); base.RegisterComponentMapping(property, mapping); }
protected override void RegisterManyToOneMapping <TProperty>(System.Linq.Expressions.Expression <System.Func <TEntity, TProperty> > property, System.Action <IManyToOneMapper> mapping) { MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property); ExplicitDeclarationsHolder.AddAsPartOfComposedId(member); base.RegisterManyToOneMapping(property, mapping); }
protected override void RegisterAnyMapping <TProperty>(Expression <Func <TEntity, TProperty> > property, System.Type idTypeOfMetaType, Action <IAnyMapper> mapping) { MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property); ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member)); base.RegisterAnyMapping(property, idTypeOfMetaType, mapping); }
public void WhenNotDeclaredExplicitOneToOneThenNoMatch() { var edo = new ExplicitDeclarationsHolder(); var relation = new Relation(typeof(MyClass), typeof(MyOneClass)); var pattern = new OneToOneUnidirectionalToManyToOnePattern(edo); pattern.Match(relation).Should().Be.False(); }
protected override void RegisterAnyMapping <TProperty>(System.Linq.Expressions.Expression <System.Func <TEntity, TProperty> > property, System.Type idTypeOfMetaType, System.Action <IAnyMapper> mapping) { MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property); MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property); ExplicitDeclarationsHolder.AddAsNaturalId(member); ExplicitDeclarationsHolder.AddAsNaturalId(memberOf); base.RegisterAnyMapping(property, idTypeOfMetaType, mapping); }
protected override void RegisterComponentMapping <TComponent>(System.Linq.Expressions.Expression <System.Func <TEntity, TComponent> > property, System.Action <IComponentMapper <TComponent> > mapping) { MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property); MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property); ExplicitDeclarationsHolder.AddAsNaturalId(member); ExplicitDeclarationsHolder.AddAsNaturalId(memberOf); base.RegisterComponentMapping(property, mapping); }
protected override void RegisterNoVisiblePropertyMapping(string notVisiblePropertyOrFieldName, System.Action <IPropertyMapper> mapping) { MemberInfo member = typeof(TEntity).GetPropertyOrFieldMatchingName(notVisiblePropertyOrFieldName); MemberInfo memberOf = member.GetMemberFromReflectedType(typeof(TEntity)); ExplicitDeclarationsHolder.AddAsNaturalId(member); ExplicitDeclarationsHolder.AddAsNaturalId(memberOf); base.RegisterNoVisiblePropertyMapping(notVisiblePropertyOrFieldName, mapping); }
public void MergeComposedId() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsPartOfComposedId(property); destination.Merge(source); destination.ComposedIds.Should().Have.Count.EqualTo(1); }
public void MergeRootEntities() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsRootEntity(typeof(MyClass)); destination.Merge(source); destination.RootEntities.Should().Have.Count.EqualTo(1); }
public void MergeComponents() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsComponent(typeof(MyClass)); destination.Merge(source); destination.Components.Should().Have.Count.EqualTo(1); }
public void MergeOneToOneRelations() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsOneToOneRelation(property); destination.Merge(source); destination.OneToOneRelations.Should().Have.Count.EqualTo(1); }
public void MergeRootEntities() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsRootEntity(typeof(MyClass)); destination.Merge(source); Assert.That(destination.RootEntities, Has.Count.EqualTo(1)); }
public void MergeDictionaries() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsMap(property); destination.Merge(source); Assert.That(destination.Dictionaries, Has.Count.EqualTo(1)); }
public void MergeDictionaries() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsMap(property); destination.Merge(source); destination.Dictionaries.Should().Have.Count.EqualTo(1); }
public void MergePersistentMembers() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsPersistentMember(property); destination.Merge(source); Assert.That(destination.PersistentMembers, Has.Count.EqualTo(1)); }
public void MergeSplitDefinitions() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsPropertySplit(new SplitDefinition(typeof(MyClass), "foo", property)); destination.Merge(source); destination.SplitDefinitions.Should().Have.Count.EqualTo(1); }
public void MergeOneToOneRelations() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsOneToOneRelation(property); destination.Merge(source); Assert.That(destination.OneToOneRelations, Has.Count.EqualTo(1)); }
public void WhenDeclaredExplicitOneToOneAndIsUnirectionalThenMatch() { var edo = new ExplicitDeclarationsHolder(); var relation = new Relation(typeof(MyClass), typeof(MyOneClass)); edo.OneToOneRelations.Add(relation); var pattern = new OneToOneUnidirectionalToManyToOnePattern(edo); pattern.Match(relation).Should().Be.True(); }
public void MergeComponents() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsComponent(typeof(MyClass)); destination.Merge(source); Assert.That(destination.Components, Has.Count.EqualTo(1)); }
public void MergeManyToManyRelations() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsManyToManyItemRelation(property); destination.Merge(source); Assert.That(destination.ItemManyToManyRelations, Has.Count.EqualTo(1)); }
public void MergeAny() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsAny(property); destination.Merge(source); Assert.That(destination.Any, Has.Count.EqualTo(1)); }
public void MergeNaturalIds() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsNaturalId(property); destination.Merge(source); destination.NaturalIds.Should().Have.Count.EqualTo(1); }
public void MergeVersionProperties() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsVersionProperty(property); destination.Merge(source); destination.VersionProperties.Should().Have.Count.EqualTo(1); }
public void MergeAny() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsAny(property); destination.Merge(source); destination.Any.Should().Have.Count.EqualTo(1); }
public void MergePersistentMembers() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsPersistentMember(property); destination.Merge(source); destination.PersistentMembers.Should().Have.Count.EqualTo(1); }
public void MergeComposedId() { var destination = new ExplicitDeclarationsHolder(); var source = new ExplicitDeclarationsHolder(); source.AddAsPartOfComposedId(property); destination.Merge(source); Assert.That(destination.ComposedIds, Has.Count.EqualTo(1)); }