Exemple #1
0
        public void AddField(Type type, Type fieldType, string fieldName)
        {
            var classInfo = _metaModel.GetClassInfo(type, true);

            // The real attribute id (-1) will be set in the ci.addAttribute
            var fullClassName = OdbClassNameResolver.GetFullName(fieldType);
            var attributeInfo = new ClassAttributeInfo(-1, fieldName, fullClassName, classInfo);

            classInfo.AddAttribute(attributeInfo);

            _objectWriter.UpdateClassInfo(classInfo, true);
        }
Exemple #2
0
 private void UpdateClass(IEnumerable<ClassAttributeInfo> dependingAttributes, IMetaModel metaModel)
 {
     foreach (var classAttributeInfo in dependingAttributes)
     {
         try
         {
             var existingClassInfo = metaModel.GetClassInfo(classAttributeInfo.GetFullClassname(), false);
             if (existingClassInfo == null)
             {
                 AddClasses(ClassIntrospector.Introspect(classAttributeInfo.GetFullClassname()));
             }
             else
             {
                 // Even,if it exist,take the one from metamodel
                 classAttributeInfo.SetClassInfo(existingClassInfo);
             }
         }
         catch (Exception e)
         {
             throw new OdbRuntimeException(
                 NDatabaseError.ClassIntrospectionError.AddParameter(classAttributeInfo.GetFullClassname()), e);
         }
     }
 }