Esempio n. 1
0
        public void Complete(IStorageWork work, ISerializationSession session)
        {
            storedGraph.SerialisedGraph = registeredGraph.Serialize(UntypedGraph, session);

            var trackedGraph = new TrackedGraph(
                storedGraph,
                CalculateIndexes(),
                registeredGraph);

            work.InsertGraph(trackedGraph);
        }
Esempio n. 2
0
        public virtual void Complete(IStorageWork work, ISerializationSession session)
        {
            storedGraph.SerialisedGraph = registeredGraph.Serialize(UntypedGraph, session);

            CompletionHash = hashCodeGenerator.ComputeHash(storedGraph.SerialisedGraph);

            //Reset stream after calculating hash.
            storedGraph.SerialisedGraph.Position = 0;

            if(CompletionHash.SequenceEqual(OriginalHash))
                //No change to object. No work to do.
                return;

            var trackedGraph = new TrackedGraph(storedGraph, CalculateIndexes(), registeredGraph);
            work.UpdateGraph(trackedGraph);
        }
        protected override void Given()
        {
            stashedPost = new Post
                {
                    Title = "My Super Blog",
                    PostedAt = new DateTime(2010, 03, 19, 13, 33, 34),
                    Text = "This is my super blog. Check out my awesome post",
                    Comments = new List<Comment>
                        {
                            new Comment
                                {
                                    Author = "Andy Hitchman",
                                    AuthorsEmail = "*****@*****.**",
                                    CommentedAt = new DateTime(2010, 03, 19, 13, 36, 01),
                                    Text = "This blog is teh suck"
                                }
                        }
                };

            var internalId = new InternalId(Guid.NewGuid());
            var registeredGraph = Kernel.Registry.GetRegistrationFor<Post>();
            var serializedGraph = registeredGraph.Serialize(stashedPost, null);
            var projectedIndexes = registeredGraph.IndexersOnGraph.SelectMany(_ => _.GetUntypedProjections(stashedPost));
            var tracked = new TrackedGraph(new StoredGraph(internalId, registeredGraph.GraphType, AccessCondition.None, serializedGraph), projectedIndexes, registeredGraph);

            Kernel.Registry.BackingStore.InTransactionDo(_ => _.InsertGraph(tracked));
        }