1
This commit is contained in:
parent
4f1193248d
commit
53f4a3c44d
@ -58,6 +58,7 @@ namespace F6
|
|||||||
{
|
{
|
||||||
public BaseMeta _meta;
|
public BaseMeta _meta;
|
||||||
public BitArray _flags = new BitArray(100);
|
public BitArray _flags = new BitArray(100);
|
||||||
|
public string _primKeyVal;
|
||||||
virtual public bool HasValue(string fieldName)
|
virtual public bool HasValue(string fieldName)
|
||||||
{
|
{
|
||||||
return this.HasValue(this.GetFieldIdx(fieldName));
|
return this.HasValue(this.GetFieldIdx(fieldName));
|
||||||
@ -132,7 +133,10 @@ namespace F6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
baseMeta.nameIdxHash.Add(f.Name, fieldIdx);
|
baseMeta.nameIdxHash.Add(f.Name, fieldIdx);
|
||||||
|
if (!baseMeta.nameIdxHash.ContainsKey(fieldName))
|
||||||
|
{
|
||||||
baseMeta.nameIdxHash.Add(fieldName, fieldIdx);
|
baseMeta.nameIdxHash.Add(fieldName, fieldIdx);
|
||||||
|
}
|
||||||
++fieldIdx;
|
++fieldIdx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,6 +146,7 @@ namespace F6
|
|||||||
{
|
{
|
||||||
T t = new T();
|
T t = new T();
|
||||||
t._meta = baseMeta;
|
t._meta = baseMeta;
|
||||||
|
row.TryGetValue(this.primKey, out t._primKeyVal);
|
||||||
Type tType = typeof(T);
|
Type tType = typeof(T);
|
||||||
Type tBaseType = tType.BaseType;
|
Type tBaseType = tType.BaseType;
|
||||||
int fieldIdx = 0;
|
int fieldIdx = 0;
|
||||||
@ -198,6 +203,7 @@ namespace F6
|
|||||||
}
|
}
|
||||||
this.rawList.Add(t);
|
this.rawList.Add(t);
|
||||||
}
|
}
|
||||||
|
this.LoadPost();
|
||||||
}catch(Exception e)
|
}catch(Exception e)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -212,7 +218,7 @@ namespace F6
|
|||||||
|
|
||||||
public class IdMetaTable<T>: RawMetaTable<T> where T : BaseTable, new()
|
public class IdMetaTable<T>: RawMetaTable<T> where T : BaseTable, new()
|
||||||
{
|
{
|
||||||
protected Dictionary<Int64, T> idHash = new Dictionary<Int64, T> ();
|
protected Dictionary<long, T> idHash = new Dictionary<long, T> ();
|
||||||
|
|
||||||
public T GetById(Int64 id)
|
public T GetById(Int64 id)
|
||||||
{
|
{
|
||||||
@ -224,11 +230,22 @@ namespace F6
|
|||||||
protected override void LoadPost()
|
protected override void LoadPost()
|
||||||
{
|
{
|
||||||
base.LoadPost();
|
base.LoadPost();
|
||||||
|
long idx = 0;
|
||||||
|
this.Traverse((T ele)=> {
|
||||||
|
if (this.primKey.Equals(""))
|
||||||
|
{
|
||||||
|
this.idHash.Add(idx, ele);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
this.idHash.Add(long.Parse(ele._primKeyVal), ele);
|
||||||
|
}
|
||||||
|
++idx;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public IdMetaTable(string fileName, string primKey) :base(fileName, primKey)
|
public IdMetaTable(string fileName, string primKey) :base(fileName, primKey)
|
||||||
{
|
{
|
||||||
// base(fileName, primKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -247,6 +264,10 @@ namespace F6
|
|||||||
protected override void LoadPost()
|
protected override void LoadPost()
|
||||||
{
|
{
|
||||||
base.LoadPost();
|
base.LoadPost();
|
||||||
|
this.Traverse((T ele) => {
|
||||||
|
this.nameHash.Add(ele._primKeyVal, ele);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public NameMetaTable(string fileName, string primKey):base(fileName, primKey)
|
public NameMetaTable(string fileName, string primKey):base(fileName, primKey)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user