예제 #1
0
 // Need to lazily initialize the attribute since we don't have an object instance when
 // the CollectionPersister is created for the overall type
 internal void Initialize(Cache cache)
 {
     if (_type != null)
     {
         return;
     }
     _type = Collection.GetType();
     _attribute.Inititalize(_type, "Collection", cache);
 }
예제 #2
0
파일: TypeCache.cs 프로젝트: wushian/Nxdb
 private void CheckMemberForPersistentAttribute(MemberInfo memberInfo, Type type,
                                                Func <object, object> getValue, Action <object, object> setValue,
                                                List <PersistentMemberInfo> persistentMemberInfo)
 {
     object[] attributes = memberInfo.GetCustomAttributes(typeof(PersistentMemberAttribute), true);
     if (attributes.Length > 0)
     {
         if (attributes.Length != 1)
         {
             throw new Exception("Only one PersistentAttribute can be used per field or property.");
         }
         PersistentMemberAttribute attribute = (PersistentMemberAttribute)attributes[0];
         attribute.Inititalize(type, memberInfo.Name, _cache);
         persistentMemberInfo.Add(new PersistentMemberInfo(type, memberInfo.Name, attribute, getValue, setValue));
     }
 }