Пример #1
0
 private void SetInvolvedTypesAttributes(ServiceMatcher propMatcher)
 {
     foreach (var attribute in involvedAttributes)
     {
         propMatcher.SetAttributeOnType(attribute.Item1, attribute.Item2, attribute.Item3);
         propMatcher.SetAttributeForAllInvolvedTypes(attribute.Item1, attribute.Item2, attribute.Item3);
     }
 }
Пример #2
0
        private Type MapType(Type type, ServicePack retPack)
        {
            Type matchType = null;

            if (CheckMapPossiblity(type, out Type typeToMap))
            {
                if (retPack.RelatedTypes.Values.Any(sType => sType.Equals(typeToMap)))
                {
                    matchType = retPack.RelatedTypes.Single(kVT => kVT.Value.Equals(typeToMap)).Key;
                }
                else if (TryToGetFromGlobalContainer(type, out Type gottenMatchType))
                {
                    matchType = gottenMatchType;

                    retPack.AddRelatedType(matchType, type);
                }
                else
                {
                    var propMatcher = new ServiceMatcher(typeToMap, TypeCategories.Dto, optimizationPackage: optimizationPackage);

                    SetInvolvedTypesAttributes(propMatcher);

                    SetInvolvedTypeMembersAttributes(propMatcher);

                    var propServicePack = propMatcher.Pack();

                    matchType = propServicePack.MatchType;

                    AddRelatedTypesToRetPack(retPack, propServicePack);
                }
            }

            matchType = WrapForArraysOrGenerics(type, retPack, matchType);

            return(matchType ?? type);
        }