Esempio n. 1
0
        public IntermediatePrimitiveMember GetIntermediatePrimitiveMember(Type entityType, String propertyName)
        {
            String[] memberNamePath    = EmbeddedMember.Split(propertyName);
            Type     currDeclaringType = entityType;

            Member[] members = new Member[memberNamePath.Length];
            for (int a = 0, size = memberNamePath.Length; a < size; a++)
            {
                IPropertyInfo property = PropertyInfoProvider.GetProperty(currDeclaringType, memberNamePath[a]);
                if (property == null)
                {
                    return(null);
                }
                members[a] = new IntermediatePrimitiveMember(currDeclaringType, entityType, property.PropertyType, property.ElementType,
                                                             property.Name, property.GetAnnotations());
                currDeclaringType = property.PropertyType;
            }
            if (members.Length > 1)
            {
                Member[] memberPath = new Member[members.Length - 1];
                Array.Copy(members, 0, memberPath, 0, memberPath.Length);
                PrimitiveMember lastMember = (PrimitiveMember)members[memberPath.Length];
                return(new IntermediateEmbeddedPrimitiveMember(entityType, lastMember.RealType, lastMember.ElementType, propertyName, memberPath,
                                                               lastMember));
            }
            return((IntermediatePrimitiveMember)members[0]);
        }
 public IntermediateEmbeddedPrimitiveMember(Type entityType, Type realType, Type elementType, String propertyName, Member[] memberPath, PrimitiveMember childMember)
     : base(entityType, entityType, realType, elementType, propertyName, null)
 {
     this.memberPath       = memberPath;
     this.childMember      = childMember;
     this.memberPathToken  = EmbeddedMember.BuildMemberPathToken(memberPath);
     this.memberPathString = EmbeddedMember.BuildMemberPathString(memberPath);
 }
Esempio n. 3
0
        protected Member GetMemberIntern(Type type, String propertyName, Type baseType)
        {
            if (propertyName.Contains("&"))
            {
                String[]          compositePropertyNames = propertyName.Split('&');
                PrimitiveMember[] members = new PrimitiveMember[compositePropertyNames.Length];
                for (int a = compositePropertyNames.Length; a-- > 0;)
                {
                    members[a] = (PrimitiveMember)GetMemberIntern(type, compositePropertyNames[a], baseType);
                }
                return(CompositeIdFactory.CreateCompositeIdMember(type, members));
            }
            Type enhancedType = GetMemberTypeIntern(type, propertyName, baseType);

            if (enhancedType == baseType)
            {
                throw new Exception("Must never happen. No enhancement for " + baseType + " has been done");
            }
            ConstructorInfo constructor = enhancedType.GetConstructor(Type.EmptyTypes);

            return((Member)constructor.Invoke(EMPTY_OBJECTS));
        }
Esempio n. 4
0
 public void SetDefinedBy(PrimitiveMember definedBy)
 {
     this.definedBy = definedBy;
 }