public void Should_return_expression_for_public_property() { var expression = Reveal.Property <StringTarget>("PublicProperty"); Assert.That(expression, Is.Not.Null); Assert.That(ReflectionHelper.GetProperty(expression).ToMember().Name, Is.EqualTo("PublicProperty")); }
public void Override(AutoMapping <BasicUser> mapping) { mapping.Map(x => x.FirstName).Nullable(); mapping.Map(x => x.LastName).Nullable(); mapping.Id(x => x.Id).GeneratedBy.HiLo("_uniquekey", "next_hi", "0", string.Format("table_name = '{0}'", "basicusers")); mapping.HasManyToMany <EventType>(Reveal.Property <BasicUser>("eventTypes")) .Table("UserByEventTypes") .ParentKeyColumn("GarmentId") .ChildKeyColumn("EventTypeId") .Cascade.None(); mapping.HasMany <Friend>(Reveal.Property <BasicUser>("friends")).Inverse().Cascade.AllDeleteOrphan(); mapping.HasMany <Friend>(Reveal.Property <BasicUser>("friendsThatInvitedMe")) .KeyColumn("UserId") .Where(string.Format("Status = {0}", (int)FriendStatus.Pending)); mapping.HasMany <Friend>(Reveal.Property <BasicUser>("friendsAccepted")). Where(string.Format("Status = {0}", (int)FriendStatus.Confirmed)); mapping.HasMany <UserFlavor>(Reveal.Property <BasicUser>("userFlavors")) .Cascade.SaveUpdate(); }
public void Should_throw_on_invalid_name() { var ex = Assert.Throws <UnknownPropertyException>(() => Reveal.Property <StringTarget>("UnknownProperty"), "Could not find property 'UnknownProperty' on '" + typeof(StringTarget).FullName + "'"); ex.Property.ShouldEqual("UnknownProperty"); ex.Type.ShouldEqual(typeof(StringTarget)); }
public SubAccountMap() { Table("SubAccount"); Id(x => x.Id) .Column("AccountId"); References(x => x.Account) .Column("AccountId"); Map(Reveal.Property <decimal>("Value")); }
public void Override(AutoMapping <Closet> mapping) { mapping.Id(x => x.Id).GeneratedBy.HiLo("_uniquekey", "next_hi", "0", string.Format("table_name = '{0}'", "closets")); mapping.HasMany <ClosetGarment>(Reveal.Property <Closet>("garments")) .Cascade.SaveUpdate(); mapping.HasMany <ClosetOutfit>(Reveal.Property <Closet>("outfits")) .Table("ClosetOutfits") .KeyColumn("ClosetId") .Cascade.SaveUpdate(); }
public ApplicationMap() { Schema("dbo"); Table("Application"); Id(x => x.Id, "ApplID").GeneratedBy.Native(); Map(x => x.ApplicationName, "ApplName"); Map(x => x.ApplicationDescription, "ApplDesc"); Map(x => x.Alias, "Alias"); Map(x => x.SupportTeamId, "TeamId"); Map(x => x.SubjectMatterExpertId, "SubjMatrExpID"); Map(x => x.MaintenanceExpirationDate, "MaintAgrmtExpDt"); Map(x => x.SupervisorNotes, "SupvrNote"); Map(x => x.SupportStaffNotes, "SuppStafNote"); Map(x => x.ServiceDeskNotes, "SrvsDeskNote"); Map(x => x.PrimaryUrl, "PrimUrl"); Map(x => x.DocumentationUrl, "DocUrl"); Map(x => x.LastUpdateUser, "Last_Updt_User"); Map(x => x.LastUpdateTimeStamp, "Last_Updt_TS"); References(Application.ApplicationExpressions.SupportTeam, "TeamId").ReadOnly(); HasManyToMany <Host>(Reveal.Property <Application>("Hosts")).Table("HostApplication").ParentKeyColumn("ApplID") .ChildKeyColumn("HostID").Cascade.None(); }
public void Override(AutoMapping <Rating> mapping) { mapping.HasMany <FriendRating>(Reveal.Property <Rating>("friendRatings")).Cascade.SaveUpdate().KeyColumn("ClosetOutfitId"); mapping.HasMany <UserRating>(Reveal.Property <Rating>("userRatings")).Cascade.SaveUpdate().KeyColumn("ClosetOutfitId"); }
public void Can_use_manytomany_using_string_name_on_private_property() { new MappingTester <StringTarget>() .ForMapping(map => map.HasManyToMany <ExampleClass>(Reveal.Property <StringTarget>("PrivateObject"))) .Element("class/bag").HasAttribute("name", "PrivateObject"); }
public void Can_use_dynamiccomponent_using_string_name_on_private_property() { new MappingTester <StringTarget>() .ForMapping(map => map.DynamicComponent(Reveal.Property <StringTarget, IDictionary>("PrivateDictionary"), x => { })) .Element("class/dynamic-component").HasAttribute("name", "PrivateDictionary"); }
public void Can_use_hasone_using_string_name_on_private_property() { new MappingTester <StringTarget>() .ForMapping(map => map.HasOne(Reveal.Property <StringTarget, ExampleClass>("PrivateObject"))) .Element("class/one-to-one").HasAttribute("name", "PrivateObject"); }
public void Can_map_using_string_name_on_protected_property() { new MappingTester <StringTarget>() .ForMapping(map => map.Map(Reveal.Property <StringTarget>("ProtectedProperty"))) .Element("class/property").HasAttribute("name", "ProtectedProperty"); }
public void Can_reveal_a_Double_property() { Reveal.Property <StringTarget>("DoubleProperty"); }
public void Can_reveal_an_int_property() { Reveal.Property <StringTarget>("IntProperty"); }
public void Can_use_version_using_string_name_on_private_property() { new MappingTester <StringTarget>() .ForMapping(map => map.Version(Reveal.Property <StringTarget>("PrivateObject"))) .Element("class/version").HasAttribute("name", "PrivateObject"); }
public void Can_use_references_using_string_name_on_private_property() { new MappingTester <StringTarget>() .ForMapping(map => map.References(Reveal.Property <StringTarget>("PrivateObject"))) .Element("class/many-to-one").HasAttribute("name", "PrivateObject"); }