mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
a few changes to db generic tables
This commit is contained in:
@@ -42,6 +42,47 @@ namespace OpenSim.Data.Null
|
||||
/// </summary>
|
||||
public class NullGenericDataHandler
|
||||
{
|
||||
protected List<T> Get<T>(string field, string val, List<T> inputEntities)
|
||||
{
|
||||
List<T> entities = inputEntities;
|
||||
|
||||
entities
|
||||
= entities.Where(
|
||||
e =>
|
||||
{
|
||||
FieldInfo fi = typeof(T).GetField(field);
|
||||
if (fi == null)
|
||||
throw new NotImplementedException(string.Format("No field {0} for val {1}", field, val));
|
||||
|
||||
return fi.GetValue(e).ToString() == val;
|
||||
}
|
||||
).ToList();
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
protected List<T> Get<T>(string field, string[] vals, List<T> inputEntities)
|
||||
{
|
||||
List<T> entities = new List<T>();
|
||||
|
||||
for (int i = 0; i < vals.Length; i++)
|
||||
{
|
||||
entities.AddRange (inputEntities.Where(
|
||||
e =>
|
||||
{
|
||||
FieldInfo fi = typeof(T).GetField(field);
|
||||
if (fi == null)
|
||||
throw new NotImplementedException(string.Format("No field {0} for val {1}", field, vals[i]));
|
||||
|
||||
return fi.GetValue(e).ToString() == vals[i];
|
||||
}
|
||||
).ToList()
|
||||
);
|
||||
}
|
||||
return entities;
|
||||
}
|
||||
|
||||
|
||||
protected List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities)
|
||||
{
|
||||
List<T> entities = inputEntities;
|
||||
|
||||
Reference in New Issue
Block a user