public void Init() { FluentMappings mappings = new FluentMappings(); mappings .Entity<RootClass>() .Columns.AutoMapSimpleTypeProperties() .For(r => r.ID).SetPrimaryKey() .Relationships.MapProperties() .For(r => r.Dupe1) .EagerLoad((db, r) => db.Query<DupedClass>().Where(d => d.ID == r.Dupe1ID).FirstOrDefault()) .For(r => r.Dupe2) .EagerLoad((db, r) => db.Query<DupedClass>().Where(d => d.ID == r.Dupe2ID).FirstOrDefault()) .Entity<DupedClass>() .Columns.AutoMapSimpleTypeProperties() .For(d => d.ID).SetPrimaryKey() .Relationships.MapProperties() .For(d => d.Child) .JoinOne(d => d.Child, (d, dcc) => d.ChildID == dcc.ID) .Entity<DupedClassChild>() .Columns.AutoMapSimpleTypeProperties() .PrefixAltNames("dcc") .For(d => d.ID).SetPrimaryKey(); }
private void CreateMappings() { var mappings = new FluentMappings(); mappings .Entity <FluentMappedOrder>() .Table.MapTable("Order") .Columns.AutoMapSimpleTypeProperties() .PrefixAltNames("o") .For(e => e.ID).SetPrimaryKey().SetAutoIncrement().SetReturnValue() .Relationships.MapProperties() .For(e => e.OrderItems) .EagerLoad((db, o) => db.Query <FluentMappedOrderItem>().Where(oi => oi.OrderID == o.ID).ToList()) //.JoinMany<FluentMappedOrderItem>(o => o.OrderItems, (o, oi) => o.ID == oi.OrderID) .Entity <FluentMappedOrderItem>() .Table.MapTable("OrderItem") .Columns.AutoMapSimpleTypeProperties() .PrefixAltNames("oi") .For(oi => oi.ID).SetPrimaryKey().SetAutoIncrement().SetReturnValue() .Relationships.MapProperties() .For(oi => oi.ItemReceipt) .JoinOne <FluentMappedReceipt>(oi => oi.ItemReceipt, (oi, r) => oi.ID == r.OrderItemID) .Entity <FluentMappedReceipt>() .Table.MapTable("Receipt") .Columns.AutoMapSimpleTypeProperties() .PrefixAltNames("r"); }
private void CreateMappings() { var mappings = new FluentMappings(); mappings .Entity<FluentMappedOrder>() .Table.MapTable("Order") .Columns.AutoMapSimpleTypeProperties() .PrefixAltNames("o") .For(e => e.ID).SetPrimaryKey().SetAutoIncrement().SetReturnValue() .Relationships.MapProperties() .For(e => e.OrderItems) .EagerLoad((db, o) => db.Query<FluentMappedOrderItem>().Where(oi => oi.OrderID == o.ID).ToList()) //.JoinMany<FluentMappedOrderItem>(o => o.OrderItems, (o, oi) => o.ID == oi.OrderID) .Entity<FluentMappedOrderItem>() .Table.MapTable("OrderItem") .Columns.AutoMapSimpleTypeProperties() .PrefixAltNames("oi") .For(oi => oi.ID).SetPrimaryKey().SetAutoIncrement().SetReturnValue() .Relationships.MapProperties() .For(oi => oi.ItemReceipt) .JoinOne<FluentMappedReceipt>(oi => oi.ItemReceipt, (oi, r) => oi.ID == r.OrderItemID) .Entity<FluentMappedReceipt>() .Table.MapTable("Receipt") .Columns.AutoMapSimpleTypeProperties() .PrefixAltNames("r"); }
public void Can_Find_Member_When_Parent_Renames() { var wrapped = new CamelCasePropertyNamesContractResolver(); var mappings = new FluentMappings(wrapped); mappings.MapClass <Obj>(cm => cm.MapMember(x => x.String, x => x.SetConverter(null))); var contract = (JsonObjectContract)mappings.ContractResolver.ResolveContract(typeof(Obj)); Assert.Equal(1, contract.Properties.Count); // ensures that we didn't make our own second property by accident }
private void CreateMappings() { var mappings = new FluentMappings(); mappings .Entity<Entities.FluentMappedOrder>() .Table.MapTable("Order") .Columns.AutoMapSimpleTypeProperties() .For(e => e.ID) .SetPrimaryKey().SetAutoIncrement().SetReturnValue() .For(e => e.OrderName) .ToDB(o => (o as string) + "[ToDB]") .FromDB(o => (o as string) + "[FromDB]"); }
public void Custom_Converter_Should_Read_Single_Property() { var mappings = new FluentMappings(); mappings.MapClass <Obj>(cm => cm.MapMember(mm => mm.String, mm => mm.SetConverter(new TestConverter()))); var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver, Binder = mappings.Binder }; var json = "{ \"String\": \"Hello World\" }"; var obj = JsonConvert.DeserializeObject <Obj>(json, sett); Assert.Equal(TestConverter.ReadRepl, obj.String); }
private void CreateMappings() { var mappings = new FluentMappings(); mappings .Entity <Entities.FluentMappedOrder>() .Table.MapTable("Order") .Columns.AutoMapSimpleTypeProperties() .For(e => e.ID) .SetPrimaryKey().SetAutoIncrement().SetReturnValue() .For(e => e.OrderName) .ToDB(o => (o as string) + "[ToDB]") .FromDB(o => (o as string) + "[FromDB]"); }
public void ShouldBeAbleToPluralizeTableNames() { var fluentMappings = new FluentMappings(); fluentMappings .ForEachEntity<IEntityBase>(entity => entity .Table.MapTable(t => t.Name + "s") ); var repos = Marr.Data.MapRepository.Instance; var buildingTable = repos.GetTableName(typeof(Building)); var roomTable = repos.GetTableName(typeof(Room)); // Check tables Assert.AreEqual("Buildings", buildingTable); Assert.AreEqual("Rooms", roomTable); }
/// <summary> /// Applies any mappings to the NHibernate Configuration /// </summary> /// <param name="cfg">NHibernate Configuration instance</param> public void Apply(Configuration cfg) { if (mergeMappings) { foreach (var model in AutoMappings) { model.MergeMappings = true; } FluentMappings.PersistenceModel.MergeMappings = true; } HbmMappings.Apply(cfg); FluentMappings.Apply(cfg); AutoMappings.Apply(cfg); }
public void Discriminator_Should_Be_Written_For_Array() { var mappings = new FluentMappings(); var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver, Binder = mappings.Binder }; mappings.MapClass <Parent>(cm => cm.SetDiscriminator("Parent")); mappings.MapClass <Child>(cm => cm.SetDiscriminator("Child")); var json = JsonConvert.SerializeObject(new Parent[] { new Child(), new Child() }, sett); Console.WriteLine(json); var linq = JsonConvert.DeserializeObject <JArray>(json); Assert.Equal("Child", linq[0]["$type"]); }
public void Can_Ignore_Property() { var mappings = new FluentMappings(); mappings.MapClass <Obj>(cm => cm.UnmapMember(x => x.String)); var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver, Binder = mappings.Binder }; var obj = new Obj { String = "Test" }; var json = JsonConvert.SerializeObject(obj, sett); var jobj = JsonConvert.DeserializeObject <JObject>(json); Assert.Empty(jobj.Properties()); }
public void Custom_Converter_Should_Write_Entire_Type() { var mappings = new FluentMappings(); mappings.MapClass <Obj>(cm => cm.SetConverter(new TestConverter())); var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver, Binder = mappings.Binder }; var obj = new Obj { String = "Hello World" }; var json = JsonConvert.SerializeObject(obj, sett); var str = JsonConvert.DeserializeObject <string>(json); // no sett Assert.Equal(TestConverter.WriteRepl, str); }
public void Class_Constructs_With_Custom_Constructor() { var mappings = new FluentMappings(); mappings.MapClass <Custom>(x => x.MapCreator(t => new Custom(t.String))); var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver, Binder = mappings.Binder }; var inst = new Custom(5); var json = JsonConvert.SerializeObject(inst, sett); Console.WriteLine(json); var newinst = JsonConvert.DeserializeObject <Custom>(json, sett); Assert.Equal(inst.String, newinst.String); }
public void Setup() { FluentMappings mappings = new FluentMappings(); mappings .Entity<Building>() .Columns.AutoMapSimpleTypeProperties() .Relationships.AutoMapICollectionOrComplexProperties() .Ignore(b => b.Offices) .Ignore(b => b.OfficesDynamic) .For("_offices") .LazyLoad((db, building) => db.Query<Office>().Where(o => o.BuildingName == building.Name).ToList()) .For("_officesDynamic") .LazyLoad((db, building) => db.Query<Office>().Where(o => o.BuildingName == building.Name).ToList()) .Entity<Office>() .Columns.AutoMapSimpleTypeProperties(); }
public void ShouldBeAbleToPluralizeTableNames() { var fluentMappings = new FluentMappings(); fluentMappings .ForEachEntity <IEntityBase>(entity => entity .Table.MapTable(t => t.Name + "s") ); var repos = Marr.Data.MapRepository.Instance; var buildingTable = repos.GetTableName(typeof(Building)); var roomTable = repos.GetTableName(typeof(Room)); // Check tables Assert.AreEqual("Buildings", buildingTable); Assert.AreEqual("Rooms", roomTable); }
public void Discriminator_Should_Be_Written_For_Child_When_Container_Is_Mapped() { var mappings = new FluentMappings(); var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver, Binder = mappings.Binder }; mappings.MapClass <Container>(cm => { }); mappings.MapClass <Parent>(cm => cm.SetDiscriminator("Parent")); mappings.MapClass <Child>(cm => cm.SetDiscriminator("Child")); var json = JsonConvert.SerializeObject(new Container() { Object = new Child() }, sett); var linq = JsonConvert.DeserializeObject <JObject>(json); Assert.Equal("Child", linq["Object"]["$type"]); }
public void Custom_Converter_Should_Write_Single_Property() { var mappings = new FluentMappings(); mappings.MapClass <Obj>(cm => cm.MapMember(mm => mm.String, mm => mm.SetConverter(new TestConverter()))); var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver, Binder = mappings.Binder }; var obj = new Obj { String = "Hello World" }; var json = JsonConvert.SerializeObject(obj, sett); Console.WriteLine(json); Assert.Contains(TestConverter.WriteRepl, json); Assert.DoesNotContain("Hello World", json); }
public void ForEachEntity_ShouldApplyMappingsToAllSubclassesInAssembly() { var fluentMappings = new FluentMappings(); fluentMappings .ForEachEntity <IEntityBase>(entity => entity .Columns.AutoMapSimpleTypeProperties() .For(e => e.ID) .SetPrimaryKey() .SetAutoIncrement() .SetReturnValue() .Relationships.AutoMapICollectionOrComplexProperties() .Tables.AutoMapTable() ); var repos = Marr.Data.MapRepository.Instance; var buildingColumns = repos.GetColumns(typeof(Building)); var buildingRelationships = repos.GetRelationships(typeof(Building)); var buildingTable = repos.GetTableName(typeof(Building)); var roomColumns = repos.GetColumns(typeof(Room)); var roomRelationships = repos.GetRelationships(typeof(Room)); var roomTable = repos.GetTableName(typeof(Room)); // Check columns Assert.IsNotNull(buildingColumns); Assert.IsNotNull(roomColumns); Assert.AreEqual(2, buildingColumns.Count); Assert.AreEqual(3, roomColumns.Count); // Check PKs Assert.IsTrue(buildingColumns.GetByColumnName("ID").ColumnInfo.IsPrimaryKey); Assert.IsTrue(roomColumns.GetByColumnName("ID").ColumnInfo.IsPrimaryKey); // Check relationships Assert.AreEqual(1, buildingRelationships.Count); Assert.IsTrue(buildingRelationships.First().RelationshipInfo.RelationType == RelationshipTypes.Many); Assert.AreEqual(1, roomRelationships.Count); Assert.IsTrue(roomRelationships.First().RelationshipInfo.RelationType == RelationshipTypes.One); // Check tables Assert.AreEqual("Building", buildingTable); Assert.AreEqual("Room", roomTable); }
public void ForEachEntity_ShouldApplyMappingsToAllSubclassesInAssembly() { var fluentMappings = new FluentMappings(); fluentMappings .ForEachEntity<IEntityBase>(entity => entity .Columns.AutoMapSimpleTypeProperties() .For(e => e.ID) .SetPrimaryKey() .SetAutoIncrement() .SetReturnValue() .Relationships.AutoMapICollectionOrComplexProperties() .Tables.AutoMapTable() ); var repos = Marr.Data.MapRepository.Instance; var buildingColumns = repos.GetColumns(typeof(Building)); var buildingRelationships = repos.GetRelationships(typeof(Building)); var buildingTable = repos.GetTableName(typeof(Building)); var roomColumns = repos.GetColumns(typeof(Room)); var roomRelationships = repos.GetRelationships(typeof(Room)); var roomTable = repos.GetTableName(typeof(Room)); // Check columns Assert.IsNotNull(buildingColumns); Assert.IsNotNull(roomColumns); Assert.AreEqual(2, buildingColumns.Count); Assert.AreEqual(3, roomColumns.Count); // Check PKs Assert.IsTrue(buildingColumns.GetByColumnName("ID").ColumnInfo.IsPrimaryKey); Assert.IsTrue(roomColumns.GetByColumnName("ID").ColumnInfo.IsPrimaryKey); // Check relationships Assert.AreEqual(1, buildingRelationships.Count); Assert.IsTrue(buildingRelationships.First().RelationshipInfo.RelationType == RelationshipTypes.Many); Assert.AreEqual(1, roomRelationships.Count); Assert.IsTrue(roomRelationships.First().RelationshipInfo.RelationType == RelationshipTypes.One); // Check tables Assert.AreEqual("Building", buildingTable); Assert.AreEqual("Room", roomTable); }
public void Setup() { FluentMappings mappings = new FluentMappings(); mappings .Entity <Building>() .Columns.AutoMapSimpleTypeProperties() .For(b => b.Name).SetPrimaryKey() .Relationships.AutoMapICollectionOrComplexProperties() .Ignore(b => b.Offices) .Ignore(b => b.OfficesDynamic) .For <Office>("_offices") .LazyLoad((db, building) => db.Query <Office>().Where(o => o.BuildingName == building.Name)) .For <Office>("_officesDynamic") .LazyLoad((db, building) => db.Query <Office>().Where(o => o.BuildingName == building.Name)) .Entity <Office>() .Columns.AutoMapSimpleTypeProperties() .For(o => o.BuildingName).SetPrimaryKey() .For(o => o.Number).SetPrimaryKey(); }
public void Setup() { MapRepository.Instance.EnableTraceLogging = true; FluentMappings mappings = new FluentMappings(); mappings .Entity<Series>() .Columns.AutoMapSimpleTypeProperties() .For(s => s.Id) .SetPrimaryKey() .Relationships.AutoMapICollectionOrComplexProperties() .Entity<Episode>() .Columns.AutoMapSimpleTypeProperties() .For(e => e.Id) .SetPrimaryKey() .SetAltName("EpisodeId") .For(e => e.Title) .SetAltName("EpisodeTitle") .Relationships.AutoMapICollectionOrComplexProperties(); }
public void Discriminator_Enables_Child_Deserialization_Into_Parent_Reference() { var mappings = new FluentMappings(); var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver, Binder = mappings.Binder }; mappings.MapClass <Parent>(cm => cm.SetDiscriminator("Parent")); mappings.MapClass <Child>(cm => cm.SetDiscriminator("Child")); var json = JsonConvert.SerializeObject(new Container() { Object = new Child() { ChildString = "Test" } }, sett); var rt = JsonConvert.DeserializeObject <Container>(json, sett); Assert.IsType <Child>(rt.Object); Assert.Equal("Test", ((Child)rt.Object).ChildString); }
protected void InitMappings() { FluentMappings mappings = new FluentMappings(); mappings .Entity <Person>() .Table.MapTable("PersonTable") .Columns.AutoMapSimpleTypeProperties() .For(p => p.ID) .SetPrimaryKey() .SetReturnValue() .SetAutoIncrement() .Relationships.AutoMapICollectionOrComplexProperties() .Entity <Pet>() .Columns.AutoMapSimpleTypeProperties() .For(p => p.ID) .SetPrimaryKey() .SetAltName("Pet_ID") .For(p => p.Name) .SetAltName("Pet_Name"); }
protected void InitMappings() { FluentMappings mappings = new FluentMappings(); mappings .Entity<Person>() .Table.MapTable("PersonTable") .Columns.AutoMapSimpleTypeProperties() .For(p => p.ID) .SetPrimaryKey() .SetReturnValue() .SetAutoIncrement() .Relationships.AutoMapICollectionOrComplexProperties() .Entity<Pet>() .Columns.AutoMapSimpleTypeProperties() .For(p => p.ID) .SetPrimaryKey() .SetAltName("Pet_ID") .For(p => p.Name) .SetAltName("Pet_Name"); }
public void Setup() { MapRepository.Instance.EnableTraceLogging = true; FluentMappings mappings = new FluentMappings(); mappings .Entity <Series>() .Columns.AutoMapSimpleTypeProperties() .For(s => s.Id) .SetPrimaryKey() .Relationships.AutoMapICollectionOrComplexProperties() .Entity <Episode>() .Columns.AutoMapSimpleTypeProperties() .For(e => e.Id) .SetPrimaryKey() .SetAltName("EpisodeId") .For(e => e.Title) .SetAltName("EpisodeTitle") .Relationships.AutoMapICollectionOrComplexProperties(); }
private void CreateMappings() { var mappings = new FluentMappings(); mappings .Entity<Entities.FluentMappedOrder>() .Table.MapTable("Order") .Columns.AutoMapSimpleTypeProperties() .For(e => e.ID).SetPrimaryKey().SetAutoIncrement().SetReturnValue() .Relationships.MapProperties() .For(e => e.OrderItems).EagerLoad((db, order) => db.Query<Entities.FluentMappedOrderItem>() .Where(oi => oi.OrderID == order.ID)) .Entity<Entities.FluentMappedOrderItem>() .Table.MapTable("OrderItem") .Columns.AutoMapSimpleTypeProperties() .For(oi => oi.ID).SetPrimaryKey().SetAutoIncrement().SetReturnValue() .Relationships.MapProperties() .For(oi => oi.ItemReceipt).EagerLoad((db, orderItem) => db.Query<Entities.FluentMappedReceipt>() .Where(r => r.OrderItemID == orderItem.ID)) .Entity<Entities.FluentMappedReceipt>() .Table.MapTable("Receipt") .Columns.AutoMapSimpleTypeProperties() .For(r => r.OrderItemID).SetPrimaryKey(); // Not really a PK, but works as a grouping key since this is a 1-1 relationship wtih order item }
/// <summary> /// Applies any mappings to the NHibernate Configuration /// </summary> /// <param name="cfg">NHibernate Configuration instance</param> public void Apply(Configuration cfg) { foreach (var autoMapping in AutoMappings) { autoMapping.SetLogger(logger); } if (mergeMappings) { foreach (var autoModel in AutoMappings) { autoModel.MergeMappings = true; } model.MergeMappings = true; } HbmMappings.Apply(cfg); FluentMappings.Apply(model); AutoMappings.Apply(cfg, model); model.Configure(cfg); }
public void Can_Roundtrip_Public_Property() { var wrapped = new CamelCasePropertyNamesContractResolver(); var mappings = new FluentMappings(wrapped); mappings.MapClass <Obj>(cm => { cm.UnmapAll(); cm.MapMember(x => x.String, x => x.SetName("string")); }); var obj = new Obj() { String = "testing 1-2-3" }; var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver }; var json = JsonConvert.SerializeObject(obj, sett); var deser = JsonConvert.DeserializeObject <Obj>(json, sett); Assert.Equal(obj.String, deser.String); }
public void Can_Roundtrip_Private_Field() { var wrapped = new CamelCasePropertyNamesContractResolver(); var mappings = new FluentMappings(wrapped); mappings.MapClass <Properties>(cm => { cm.UnmapAll(); cm.MapMember(x => x._string, x => x.SetName("String")); }); var contract = (JsonObjectContract)mappings.ContractResolver.ResolveContract(typeof(Properties)); Assert.Equal(1, contract.Properties.Count); // ensures that we didn't make our own second property by accident Assert.Equal(nameof(_string), contract.Properties[0].UnderlyingName); _string = "Testing 1-2-3"; var sett = new JsonSerializerSettings { ContractResolver = mappings.ContractResolver }; var json = JsonConvert.SerializeObject(this, sett); var deser = JsonConvert.DeserializeObject <Properties>(json, sett); Assert.Equal(_string, deser._string); }
private void CreateMappings() { var mappings = new FluentMappings(); mappings .Entity <Entities.FluentMappedOrder>() .Table.MapTable("Order") .Columns.AutoMapSimpleTypeProperties() .For(e => e.ID).SetPrimaryKey().SetAutoIncrement().SetReturnValue() .Relationships.MapProperties() .For(e => e.OrderItems).EagerLoad((db, order) => db.Query <Entities.FluentMappedOrderItem>() .Where(oi => oi.OrderID == order.ID)) .Entity <Entities.FluentMappedOrderItem>() .Table.MapTable("OrderItem") .Columns.AutoMapSimpleTypeProperties() .For(oi => oi.ID).SetPrimaryKey().SetAutoIncrement().SetReturnValue() .Relationships.MapProperties() .For(oi => oi.ItemReceipt).EagerLoad((db, orderItem) => db.Query <Entities.FluentMappedReceipt>() .Where(r => r.OrderItemID == orderItem.ID)) .Entity <Entities.FluentMappedReceipt>() .Table.MapTable("Receipt") .Columns.AutoMapSimpleTypeProperties() .For(r => r.OrderItemID).SetPrimaryKey(); // Not really a PK, but works as a grouping key since this is a 1-1 relationship wtih order item }
public FluentMappingsPocoData(Type t, FluentMappings.TypeDefinition typeConfig) { type = t; TableInfo = new TableInfo(); // Get the table name var a = typeConfig.TableName ?? ""; TableInfo.TableName = a.Length == 0 ? t.Name : a; // Get the primary key a = typeConfig.PrimaryKey ?? ""; TableInfo.PrimaryKey = a.Length == 0 ? "ID" : a; a = typeConfig.SequenceName ?? ""; TableInfo.SequenceName = a.Length == 0 ? null : a; TableInfo.AutoIncrement = typeConfig.AutoIncrement ?? true; // Set autoincrement false if primary key has multiple columns TableInfo.AutoIncrement = TableInfo.AutoIncrement ? !TableInfo.PrimaryKey.Contains(',') : TableInfo.AutoIncrement; // Call column mapper if (Database.Mapper != null) Database.Mapper.GetTableInfo(t, TableInfo); // Work out bound properties bool explicitColumns = typeConfig.ExplicitColumns ?? false; Columns = new Dictionary<string, Database.PocoColumn>(StringComparer.OrdinalIgnoreCase); foreach (var pi in t.GetProperties()) { // Work out if properties is to be included var isColumnDefined = typeConfig.ColumnConfiguration.ContainsKey(pi.Name); if (explicitColumns) { if (!isColumnDefined) continue; } else { if (isColumnDefined && (typeConfig.ColumnConfiguration[pi.Name].IgnoreColumn.HasValue && typeConfig.ColumnConfiguration[pi.Name].IgnoreColumn.Value)) continue; } var pc = new Database.PocoColumn(); pc.PropertyInfo = pi; // Work out the DB column name if (isColumnDefined) { var colattr = typeConfig.ColumnConfiguration[pi.Name]; pc.ColumnName = colattr.DbColumnName; if (colattr.ResultColumn.HasValue && colattr.ResultColumn.Value) pc.ResultColumn = true; else if (colattr.VersionColumn.HasValue && colattr.VersionColumn.Value) pc.VersionColumn = true; if (TableInfo.PrimaryKey.Split(',').Contains(pi.Name)) TableInfo.PrimaryKey = (pc.ColumnName ?? pi.Name) + ","; pc.ColumnType = colattr.DbColumnType; } if (pc.ColumnName == null) { pc.ColumnName = pi.Name; if (Database.Mapper != null && !Database.Mapper.MapPropertyToColumn(pi, ref pc.ColumnName, ref pc.ResultColumn)) continue; } // Store it Columns.Add(pc.ColumnName, pc); } // Trim trailing slash if built using Property names TableInfo.PrimaryKey = TableInfo.PrimaryKey.TrimEnd(','); // Build column list for automatic select QueryColumns = (from c in Columns where !c.Value.ResultColumn select c.Key).ToArray(); }
public void Cannot_Resolve_Null() { var mappings = new FluentMappings(); Assert.Throws <ArgumentNullException>(() => mappings.ContractResolver.ResolveContract(null)); }