Exemple #1
0
        ReferenceIdentity?GetReference(IFormatReader parameter)
        {
            var identity = ReferenceIdentity.Get(parameter);

            if (identity.HasValue)
            {
                return(new ReferenceIdentity(identity.Value));
            }

            var type   = _classification.GetClassification(parameter, _definition);
            var entity = _entities.Get(type)?.Reference(parameter);

            if (entity != null)
            {
                return(new ReferenceIdentity(type, entity));
            }

            return(null);
        }
            ReferenceIdentity?Entity(IFormatReader reader, object instance)
            {
                var typeInfo = instance.GetType().GetTypeInfo();
                var entity   = _entities.Get(typeInfo)?.Get(reader);
                var result   = entity != null
                                                     ? (ReferenceIdentity?)new ReferenceIdentity(typeInfo, entity)
                                                     : null;

                return(result);
            }
Exemple #3
0
        ReferenceIdentity?GetReference(IFormatReader parameter)
        {
            if (parameter.Get().To <XmlReader>().NodeType != XmlNodeType.Attribute ||
                MemberProperty.Default.Get(parameter))
            {
                var identity = ReferenceIdentity.Get(parameter);
                if (identity.HasValue)
                {
                    return(new ReferenceIdentity(identity.Value));
                }

                var type   = _classification.GetClassification(parameter, _definition);
                var entity = _entities.Get(type)?.Reference(parameter);
                if (entity != null)
                {
                    return(new ReferenceIdentity(type, entity));
                }
            }

            return(null);
        }
 Identifier Get(object parameter)
 => new Identifier(_generator.For(parameter), _entities.Get(parameter.GetType()
                                                            .GetTypeInfo()));
Exemple #5
0
 public static T Get <T>(string key)
 {
     return(_cache.Get <T>(key));
 }
 protected override Identifier Create(object parameter)
 => new Identifier(_generator.For(parameter), _entities.Get(parameter.GetType()));