Skip to content

Commit 0a2cb93

Browse files
committed
feature is implemented, all tests pass, now let's cover it with unit tests and specs
1 parent 81bdbc0 commit 0a2cb93

File tree

7 files changed

+13
-16
lines changed

7 files changed

+13
-16
lines changed

src/FluentNHibernate.Testing/Visitors/ComponentColumnPrefixVisitorSpecs2.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ public override void because()
4343
[Test]
4444
public void should_prefix_field_columns()
4545
{
46-
var t = targetMapping.Components.Single();
47-
Console.Write("fdkgndfgkndfgkjn");
48-
//.Properties.SelectMany(x => x.Columns)
49-
//.Each(c => c.Name.ShouldStartWith("component"));
46+
targetMapping.Components.Single()
47+
.Properties.SelectMany(x => x.Columns)
48+
.Each(c => c.Name.ShouldStartWith("component"));
5049
}
5150
}
5251

src/FluentNHibernate/Mapping/ComponentMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override ReferenceComponentPart<TComponent> Component<TComponent>(Express
5454

5555
protected override ComponentMapping CreateComponentMappingRoot(AttributeStore store)
5656
{
57-
return new ExternalComponentMapping(ComponentType.Component, attributes.Clone());
57+
return new ExternalComponentMapping(ComponentType.Component, attributes.Clone(), member);
5858
}
5959

6060
ExternalComponentMapping IExternalComponentMappingProvider.GetComponentMapping()

src/FluentNHibernate/Mapping/ComponentPart.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ IComponentMapping IComponentMappingProvider.GetComponentMapping()
4949

5050
protected override ComponentMapping CreateComponentMappingRoot(AttributeStore store)
5151
{
52-
var componentMappingRoot = new ComponentMapping(ComponentType.Component, store)
52+
var componentMappingRoot = new ComponentMapping(ComponentType.Component, store, member)
5353
{
5454
ContainingEntityType = entity
5555
};

src/FluentNHibernate/Mapping/ComponentPartBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace FluentNHibernate.Mapping
1010
public abstract class ComponentPartBase<TEntity, TBuilder> : ClasslikeMapBase<TEntity>
1111
where TBuilder : ComponentPartBase<TEntity, TBuilder>
1212
{
13-
readonly Member member;
13+
protected readonly Member member;
1414
readonly MappingProviderStore providers;
1515
readonly AccessStrategyBuilder<TBuilder> access;
1616
readonly AttributeStore attributes;

src/FluentNHibernate/Mapping/DynamicComponentPart.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private DynamicComponentPart(Type entity, Member member, AttributeStore underlyi
2323

2424
protected override ComponentMapping CreateComponentMappingRoot(AttributeStore store)
2525
{
26-
return new ComponentMapping(ComponentType.DynamicComponent, store)
26+
return new ComponentMapping(ComponentType.DynamicComponent, store, member)
2727
{
2828
ContainingEntityType = entity
2929
};

src/FluentNHibernate/MappingModel/ClassBased/ComponentMapping.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ public class ComponentMapping : ComponentMappingBase, IComponentMapping
1111
public ComponentType ComponentType { get; set; }
1212
readonly AttributeStore attributes;
1313

14-
public ComponentMapping(ComponentType componentType)
15-
: this(componentType, new AttributeStore())
14+
public ComponentMapping(ComponentType componentType): this(componentType, new AttributeStore(), null)
1615
{}
1716

18-
public ComponentMapping(ComponentType componentType, AttributeStore attributes)
19-
: base(attributes)
17+
public ComponentMapping(ComponentType componentType, AttributeStore attributes, Member member): base(attributes)
2018
{
2119
ComponentType = componentType;
2220
this.attributes = attributes;
21+
Member = member;
2322
}
2423

2524
public override void AcceptVisitor(IMappingModelVisitor visitor)

src/FluentNHibernate/MappingModel/ClassBased/ExternalComponentMapping.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ namespace FluentNHibernate.MappingModel.ClassBased
88
[Serializable]
99
public class ExternalComponentMapping : ComponentMapping
1010
{
11-
public ExternalComponentMapping(ComponentType componentType)
12-
: this(componentType, new AttributeStore())
11+
public ExternalComponentMapping(ComponentType componentType): this(componentType, new AttributeStore(), null)
1312
{}
1413

15-
public ExternalComponentMapping(ComponentType componentType, AttributeStore underlyingStore)
16-
: base(componentType, underlyingStore)
14+
public ExternalComponentMapping(ComponentType componentType, AttributeStore underlyingStore, Member member)
15+
: base(componentType, underlyingStore, member)
1716
{}
1817
}
1918
}

0 commit comments

Comments
 (0)