public DiscriminatorMapping() { _attributes = new AttributeStore<DiscriminatorMapping>(); _attributes.SetDefault(x => x.IsNotNullable, true); _attributes.SetDefault(x => x.Insert, true); _attributes.SetDefault(x => x.DiscriminatorType, DiscriminatorType.String); }
public void Cascade_should_be_fluent() { var oneToManyPart = new OneToManyPart<Artist, Album>(null); var attributeStore = new AttributeStore<ICollectionMapping>(); var cascadePart = new CascadePart<OneToManyPart<Artist, Album>>(oneToManyPart, attributeStore); cascadePart.All().ShouldEqual(oneToManyPart); }
public void Can_set_cascade_save_update() { var attributeStore = new AttributeStore<ICollectionMapping>(); var cascadePart = new CascadePart<OneToManyPart<Artist, Album>>(null, attributeStore); cascadePart.SaveUpdate(); attributeStore.Get(x => x.Cascade).ShouldEqual(CollectionCascadeType.SaveUpdate); }
public void CopyTo(AttributeStore store) { foreach (var pair in attributes) store.attributes[pair.Key] = pair.Value; foreach (var pair in defaults) store.defaults[pair.Key] = pair.Value; }
public void MappedShouldDefaultToTrueIfNameAttributeIsSet() { var store = new AttributeStore<CompositeIdMapping>(); store.Set(x => x.Name, "someName"); var mapping = new CompositeIdMapping(store.CloneInner()); mapping.Mapped.ShouldBeTrue(); }
public void Can_set_cascade_all_delete_orphan() { var attributeStore = new AttributeStore<ICollectionMapping>(); var cascadePart = new CollectionCascadePart<OneToManyPart<Artist, Album>>(null, attributeStore); cascadePart.AllDeleteOrphan(); attributeStore.Get(x => x.Cascade).ShouldEqual(CollectionCascadeType.AllDeleteOrphan); }
public void MappedShouldDefaultToFalseIfNameAttributeIsBlank() { var store = new AttributeStore<CompositeIdMapping>(); store.Set(x => x.Name, string.Empty); var mapping = new CompositeIdMapping(store.CloneInner()); mapping.Mapped.ShouldBeFalse(); }
public void Merge(AttributeStore otherStore) { foreach (var key in otherStore.defaults.Keys) defaults[key] = otherStore.defaults[key]; foreach (var key in otherStore.attributes.Keys) attributes[key] = otherStore.attributes[key]; }
public DiscriminatorMapping(ClassMapping parentClass) { ParentClass = parentClass; attributes = new AttributeStore<DiscriminatorMapping>(); attributes.SetDefault(x => x.NotNull, true); attributes.SetDefault(x => x.Insert, true); attributes.SetDefault(x => x.Type, typeof(string)); }
public void ShouldPassClassmappingsToTheVisitor() { // FakeItEasy calls ToString methods, which ends up in NullPointer // if Type attribute is not the AttributeStore var attributeStore = new AttributeStore(); attributeStore.Set("Type", 0, typeof(object)); var hibMap = new HibernateMapping(); var classMap = new ClassMapping(attributeStore); hibMap.AddClass(classMap); var visitor = A.Fake<IMappingModelVisitor>(); hibMap.AcceptVisitor(visitor); A.CallTo(() => visitor.Visit(classMap)).MustHaveHappened(); }
protected ParentMapping(AttributeStore attributes) { this.attributes = attributes; }
public VersionMapping(AttributeStore underlyingStore) : base(underlyingStore) { }
public ColumnMapping(AttributeStore underlyingStore) { attributes = new AttributeStore <ColumnMapping>(new DerivedAttributeStore(underlyingStore)); }
public FilterMapping(AttributeStore underlyingStore) { attributes = new AttributeStore <FilterMapping>(underlyingStore); }
public ManyToOneMapping() { _attributes = new AttributeStore<ManyToOneMapping>(); }
public NaturalIdMapping(AttributeStore attributes) { this.attributes = attributes; }
public ColumnMapping(AttributeStore<ColumnMapping> attributes) { this.attributes = attributes; }
protected ColumnBasedMappingBase(AttributeStore underlyingStore) { attributes = underlyingStore.Clone(); }
public void CopyTo(AttributeStore theirStore) { layeredValues.CopyTo(theirStore.layeredValues); }
public AnyMapping(AttributeStore attributes) { this.attributes = attributes; }
protected PropertyMapping(AttributeStore store) : base(store) { _attributes = new AttributeStore<PropertyMapping>(store); }
protected MetaValueMapping(AttributeStore attributes) { this.attributes = attributes; }
public FilterMapping(AttributeStore attributes) { this.attributes = attributes; }
public ImportMapping(AttributeStore attributes) { this.attributes = attributes; }
protected ClassMapping(AttributeStore store) : base(store) { _attributes = new AttributeStore<ClassMapping>(store); _subclasses = new List<ISubclassMapping>(); }
public void Merge(AttributeStore columnAttributes) { columnAttributes.layeredValues.CopyTo(layeredValues); }
public FilterDefinitionMapping(AttributeStore underlyingStore) { attributes = new AttributeStore<FilterMapping>(underlyingStore); parameters = new Dictionary<string, IType>(); }
public ColumnMapping(AttributeStore attributes) { this.attributes = attributes; }
public void CopyTo(AttributeStore store) { foreach (KeyValuePair<string, object> pair in _attributes) store._attributes[pair.Key] = pair.Value; }
public VersionMapping(AttributeStore underlyingStore) : base(underlyingStore) {}
public void MergeAttributes(AttributeStore columnAttributes) { attributes.Merge(columnAttributes); }
public KeyMapping(AttributeStore underlyingStore) { attributes = new AttributeStore <KeyMapping>(underlyingStore); }
public HibernateMapping() { attributes = new AttributeStore<HibernateMapping>(); classes = new List<ClassMapping>(); imports = new List<ImportMapping>(); }
public DiscriminatorMapping(AttributeStore underlyingStore) : base(underlyingStore) { }
public void Should_pass_subclasses_to_the_visitor() { // FakeItEasy ;for some reason; calls ToString method on SubClassMapping // which ended in NullPointerException if AttributeStore didn't contain Type attribute. var attributeStore = new AttributeStore(); attributeStore.Set("Type", 0, typeof(object)); var classMap = new ClassMapping(); classMap.Set(x => x.Name, Layer.Defaults, "class1"); classMap.AddSubclass(new SubclassMapping(SubclassType.JoinedSubclass, attributeStore)); var visitor = A.Fake<IMappingModelVisitor>(); classMap.AcceptVisitor(visitor); A.CallTo(() => visitor.Visit(classMap.Subclasses.First())).MustHaveHappened(); }
protected ComponentMapping(AttributeStore store) : base(store) { _attributes = new AttributeStore<ComponentMapping>(store); _mappedMembers = new MappedMembers(); }
protected JoinedSubclassMapping(AttributeStore store) : base(store) { _subclasses = new List<JoinedSubclassMapping>(); _attributes = new AttributeStore<JoinedSubclassMapping>(store); }
public PropertyMapping(AttributeStore underlyingStore) : base(underlyingStore) { }
public static T GetOrDefault <T>(this AttributeStore store, string attribute) { return((T)(store.Get(attribute) ?? default(T))); }
public OneToOneMapping(AttributeStore underlyingStore) { attributes = new AttributeStore <OneToOneMapping>(underlyingStore); }
public FilterMapping(AttributeStore underlyingStore) { attributes = new AttributeStore<FilterMapping>(underlyingStore); }
public JoinMapping(AttributeStore underlyingStore) { attributes = new AttributeStore <JoinMapping>(underlyingStore); mappedMembers = new MappedMembers(); }
public CacheMapping(AttributeStore underlyingStore) { attributes = new AttributeStore <CacheMapping>(underlyingStore); }
public HibernateMapping() { _attributes = new AttributeStore<HibernateMapping>(); _classes = new List<ClassMapping>(); }
public ColumnMapping() { _attributes = new AttributeStore<ColumnMapping>(); }
protected MapsMemberBase(AttributeStore underlyingStore) { _attributes = new AttributeStore<MapsMemberBase>(underlyingStore); _attributes.SetDefault(x => x.MemberAccess, MemberAccess.CreateDefault()); }
internal void MergeAttributes(AttributeStore <ColumnMapping> store) { attributes.Merge(store); }