本文整理汇总了C#中AttributesMappingManager类的典型用法代码示例。如果您正苦于以下问题:C# AttributesMappingManager类的具体用法?C# AttributesMappingManager怎么用?C# AttributesMappingManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttributesMappingManager类属于命名空间,在下文中一共展示了AttributesMappingManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SupportsBoolFalse
public void SupportsBoolFalse() {
var mapper = new AttributesMappingManager();
var ser = new SolrDocumentSerializer<TestDocWithBool>(mapper, new DefaultFieldSerializer());
var doc = new TestDocWithBool {B = false};
string fs = ser.Serialize(doc, null).ToString(SaveOptions.DisableFormatting);
Assert.AreEqual("<doc><field name=\"B\">false</field></doc>", fs);
}
示例2: EscapesStrings
public void EscapesStrings() {
var mapper = new AttributesMappingManager();
var ser = new SolrDocumentSerializer<SampleDoc>(mapper, new DefaultFieldSerializer());
var doc = new SampleDoc {Id = "<quote\""};
string fs = ser.Serialize(doc, null).ToString(SaveOptions.DisableFormatting);
Assert.AreEqual("<doc><field name=\"Id\"><quote\"</field><field name=\"Flower\">0</field></doc>", fs);
}
示例3: AcceptsEmptyCollections
public void AcceptsEmptyCollections() {
var mapper = new AttributesMappingManager();
var ser = new SolrDocumentSerializer<TestDocWithCollections>(mapper, new DefaultFieldSerializer());
var doc = new TestDocWithCollections { coll = new string[] { null, null } };
string fs = ser.Serialize(doc, null).ToString(SaveOptions.DisableFormatting);
Assert.AreEqual("<doc />", fs);
}
示例4: SupportsCollections
public void SupportsCollections() {
var mapper = new AttributesMappingManager();
var ser = new SolrDocumentSerializer<TestDocWithCollections>(mapper, new DefaultFieldSerializer());
var doc = new TestDocWithCollections();
string fs = ser.Serialize(doc, null).ToString(SaveOptions.DisableFormatting);
Assert.AreEqual("<doc><field name=\"coll\">one</field><field name=\"coll\">two</field></doc>", fs);
}
示例5: SupportsDateTime
public void SupportsDateTime() {
var mapper = new AttributesMappingManager();
var ser = new SolrDocumentSerializer<TestDocWithDate>(mapper, new DefaultFieldSerializer());
var doc = new TestDocWithDate {Date = new DateTime(2001, 1, 2, 3, 4, 5)};
string fs = ser.Serialize(doc, null).ToString(SaveOptions.DisableFormatting);
Assert.AreEqual("<doc><field name=\"Date\">2001-01-02T03:04:05Z</field></doc>", fs);
}
示例6: AcceptsNullObjects
public void AcceptsNullObjects()
{
var mapper = new AttributesMappingManager();
var ser = new SolrDocumentSerializer<SampleDoc>(mapper, new DefaultFieldSerializer());
var doc = new SampleDoc {Id = null};
ser.Serialize(doc, null).ToString();
}
示例7: Inherited
public void Inherited() {
var m = new AttributesMappingManager();
var fields = m.GetFields(typeof (InheritedEntity));
Assert.AreEqual(3, fields.Count);
var uniqueKey = m.GetUniqueKey(typeof(InheritedEntity));
Assert.IsNotNull(uniqueKey);
Assert.AreEqual("Id", uniqueKey.FieldName);
}
示例8: GetUniqueKey
public void GetUniqueKey() {
var m = new AttributesMappingManager();
var key = m.GetUniqueKey(typeof (Entity));
Assert.IsNotNull(key);
Assert.IsNotNull(key.Property);
Assert.AreEqual("Id", key.Property.Name);
Assert.AreEqual("Id", key.FieldName);
}
示例9: Parse
public void Parse()
{
var mapper = new AttributesMappingManager();
var parser = new CollapseExpandResponseParser<Doc>(new SolrDocumentResponseParser<Doc>(mapper, new DefaultDocumentVisitor(mapper, new DefaultFieldParser()), new SolrDocumentActivator<Doc>()));
var xml = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.collapseWithoutExpandResponse.xml");
var results = new SolrQueryResults<Doc>();
parser.Parse(xml, results);
Assert.IsNull(results.CollapseExpand);
}
示例10: ParseResponseWithLocation
public void ParseResponseWithLocation() {
var mapper = new AttributesMappingManager();
var parser = new DefaultResponseParser<Doc>(new SolrDocumentResponseParser<Doc>(mapper, new DefaultDocumentVisitor(mapper, new DefaultFieldParser()), new SolrDocumentActivator<Doc>()));
var xml = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.response.xml");
var results = new SolrQueryResults<Doc>();
parser.Parse(xml, results);
Assert.AreEqual(1, results.Count);
Assert.AreEqual(new Location(51.5171, -0.1062), results[0].Loc);
}
示例11: GetRegisteredTypes
public void GetRegisteredTypes()
{
var m = new AttributesMappingManager();
var types = m.GetRegisteredTypes();
Assert.GreaterThan(types.Count, 0);
Assert.Contains(types, typeof(Entity));
Assert.Contains(types, typeof(InheritedEntity));
Assert.Contains(types, typeof(AnotherEntity));
Assert.DoesNotContain(types, typeof(NoProperties));
}
示例12: Serializes
public void Serializes()
{
var mapper = new AttributesMappingManager();
var ser = new SolrDocumentSerializer<SampleDoc>(mapper, new DefaultFieldSerializer());
var doc = new SampleDoc {Id = "id", Dd = 23.5m};
string fs = ser.Serialize(doc, null).OuterXml;
var xml = new XmlDocument();
xml.LoadXml(fs);
Assert.AreEqual("<doc><field name=\"Id\">id</field><field name=\"Flower\">23.5</field></doc>", fs);
}
示例13: GetRegisteredTypes
public void GetRegisteredTypes()
{
var m = new AttributesMappingManager();
var types = m.GetRegisteredTypes();
Assert.That(types.Count, Is.GreaterThan(0));
Assert.That(types, Contains.Item(typeof(Entity)));
Assert.That(types, Contains.Item(typeof(InheritedEntity)));
Assert.That(types, Contains.Item(typeof(AnotherEntity)));
Assert.That(types, !Contains.Item(typeof(NoProperties)));
}
示例14: FieldBoost
public void FieldBoost()
{
var mapper = new AttributesMappingManager();
ISolrDocumentSerializer<TestDocWithBoostedString> ser = new SolrDocumentSerializer<TestDocWithBoostedString>(mapper, new DefaultFieldSerializer());
var doc = new TestDocWithBoostedString {
Desc = "hello"
};
string fs = ser.Serialize(doc, null).ToString(SaveOptions.DisableFormatting);
Assert.AreEqual(@"<doc><field name=""Desc"" boost=""1.45"">hello</field></doc>", fs);
}
示例15: AcceptsNullObjects
public void AcceptsNullObjects()
{
var mapper = new AttributesMappingManager();
var ser = new SolrDocumentSerializer<SampleDoc>(mapper, new DefaultFieldSerializer());
var doc = new SampleDoc {Id = null};
string fs = ser.Serialize(doc, null).OuterXml;
Console.WriteLine(fs);
var xml = new XmlDocument();
xml.LoadXml(fs);
}