Example #1
0
        public override void Load(object target)
        {
            var entity = EntityContainer.AsEntity(target);

            if (entity == null)
            {
                throw new ArgumentNullException("target");
            }

            var entityType    = entity.Type;
            var id            = entity.Id;
            var contentStream = _memoAccessor.LoadEntityValue(entityType.FullName, id);

            var settings = new XmlReaderSettings();

            {
                settings.IgnoreComments   = true;
                settings.IgnoreWhitespace = true;
            }

            using (var reader = XmlReader.Create(new StringReader(contentStream), settings)) {
                var context = new StoreContext()
                {
                    Id     = id,
                    Type   = entityType,
                    Reader = reader,
                };

                reader.Read(); /// fetch doctype
                reader.Read(); /// fetch Type
                LoadType(context, target, entityType);
            }
        }