public object MapToIdlAbstractValueType(Type clsType) { omg.org.CORBA.TypeCode baseTypeCode; if (clsType.BaseType.Equals(ReflectionHelper.ObjectType) || clsType.BaseType.Equals(typeof(System.ComponentModel.MarshalByValueComponent))) { baseTypeCode = new NullTC(); } else { baseTypeCode = CreateOrGetTypeCodeForType(clsType.BaseType, AttributeExtCollection.EmptyCollection); } ValueTypeTC result = new ValueTypeTC(); RegisterCreatedTypeCodeForType(clsType, AttributeExtCollection.EmptyCollection, result); result.Initalize(Repository.GetRepositoryID(clsType), IdlNaming.ReverseIdlToClsNameMapping(clsType.Name), new ValueMember[0], baseTypeCode, ABSTRACT_VALUE_MOD); return result; }
public object MapToIdlConcreateValueType(Type clsType) { omg.org.CORBA.TypeCode baseTypeCode; if (clsType.BaseType.Equals(ReflectionHelper.ObjectType) || clsType.BaseType.Equals(typeof(System.ComponentModel.MarshalByValueComponent))) { baseTypeCode = new NullTC(); } else { baseTypeCode = CreateOrGetTypeCodeForType(clsType.BaseType, AttributeExtCollection.EmptyCollection); } ValueTypeTC result = new ValueTypeTC(); RegisterCreatedTypeCodeForType(clsType, AttributeExtCollection.EmptyCollection, result); // create the TypeCodes for the members FieldInfo[] members = ReflectionHelper.GetAllDeclaredInstanceFieldsOrdered(clsType); ValueMember[] valueMembers = new ValueMember[members.Length]; for (int i = 0; i < members.Length; i++) { omg.org.CORBA.TypeCode memberType = CreateOrGetTypeCodeForType(members[i].FieldType, ReflectionHelper.GetCustomAttriutesForField(members[i], true)); short visibility; if (members[i].IsPrivate) { visibility = VISIBILITY_PRIVATE; } else { visibility = VISIBILITY_PUBLIC; } valueMembers[i] = new ValueMember(members[i].Name, memberType, visibility); } result.Initalize(Repository.GetRepositoryID(clsType), IdlNaming.ReverseIdlToClsNameMapping(clsType.Name), valueMembers, baseTypeCode, CONCRETE_VALUE_MOD); return result; }