Пример #1
0
        private Type GetPersonaLayerType(IPersona persona)
        {
            if (_targetApplicationLayer == null)
            {
                return(persona.GetType());
            }
            string typeNamespace = null;
            Type   personaType   = persona.GetType();

            typeNamespace = personaType.FullName.TrimEnd(personaType.Name.ToCharArray()) +
                            _targetApplicationLayer;
            typeNamespace = typeNamespace + "." + personaType.Name + ", " + personaType.Assembly;
            Type type = Type.GetType(typeNamespace);

            if (type == null)
            {
                throw new NotImplementedException(
                          Environment.NewLine
                          + "Could not create instance of Persona with namespace " + typeNamespace
                          + Environment.NewLine);
            }
            return(type);
        }
Пример #2
0
 private Type GetPersonaLayerType(IPersona persona)
 {
     if (_targetApplicationLayer == null)
         return persona.GetType();
     string typeNamespace = null;
     Type personaType = persona.GetType();
     typeNamespace = personaType.FullName.TrimEnd(personaType.Name.ToCharArray()) +
                     _targetApplicationLayer;
     typeNamespace = typeNamespace + "." + personaType.Name + ", " + personaType.Assembly;
     Type type = Type.GetType(typeNamespace);
     if (type == null)
         throw new NotImplementedException(
             Environment.NewLine
             + "Could not create instance of Persona with namespace " + typeNamespace
             + Environment.NewLine);
     return type;
 }