2using System.Collections.Generic;
3using System.Reflection;
4using System.Threading.Tasks;
34 private readonly Dictionary<string, KeyValuePair<PropertyInfo, FieldInfo>> memberInfo =
new Dictionary<string, KeyValuePair<PropertyInfo, FieldInfo>>();
36 private bool initialized;
51 this.ExternalSource =
null;
52 this.Definition = Label;
75 int i, c = PropertyNames.Length;
78 for (i = 0; i < c; i++)
92 [DefaultValueStringEmpty]
105 public async Task<object>
GetValue(
object Instance)
107 if (Instance is
null)
115 KeyValuePair<PropertyInfo, FieldInfo> P;
117 T = Instance.GetType();
119 lock (this.memberInfo)
121 if (!this.memberInfo.TryGetValue(T.FullName, out P))
123 P =
new KeyValuePair<PropertyInfo, FieldInfo>(
124 T.GetRuntimeProperty(
this.Definition),
125 T.GetRuntimeField(
this.Definition));
127 this.memberInfo[T.FullName] = P;
131 if (!(P.Key is
null))
133 if (P.Key.DeclaringType.IsAssignableFrom(Instance.GetType()))
134 return P.Key.GetValue(Instance);
136 else if (!(P.Value is
null))
138 if (P.Value.DeclaringType.IsAssignableFrom(Instance.GetType()))
139 return P.Value.GetValue(Instance);
144 if (!this.initialized)
146 this.initialized =
true;
152 if (!(this.evaluator is
null))
158 if (!(this.evaluator is
null))
162 return await this.evaluator.Evaluate(Instance);
183 if (!this.initialized)
185 this.initialized =
true;
197 if (!(this.evaluator is
null))
212 if (!(this.evaluator is
null))
213 return await this.evaluator.Evaluate(Instance);
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Defines an indexable property.
PropertyDefinition(string ExternalSource, string Definition)
Defines an indexable property.
PropertyDefinition(string Label)
Defines an indexable property.
string ExternalSource
External source.
PropertyType Type
Type of property definition
async Task< object > GetValue(GenericObject Instance)
Gets the object to index.
static PropertyDefinition[] ToArray(string[] PropertyNames)
Creates an array of property definitions from an array of property names.
string Definition
Definition, as a string.
PropertyDefinition()
Defines an indexable property.
async Task< object > GetValue(object Instance)
Gets the object to index.
Generic object. Contains a sequence of properties.
bool TryGetFieldValue(string PropertyName, out object Value)
Gets the value of a field or property of the object, given its name.
Static class that dynamically manages types and interfaces available in the runtime environment.
static Type GetType(string FullName)
Gets a type, given its full name.
static object Create(bool ReturnNullIfFail, Type Type, params object[] Arguments)
Returns an instance of the type Type . Creates an instance of a type. If the constructor requires arg...
Custom external property evaluator.
Task Prepare(string Definition)
Prepares the evaluator with its definition.
TypeNameSerialization
How the type name should be serialized.
PropertyType
Type of indexed property.