コード例 #1
0
        protected virtual bool VisitCollectionsBeforeSave(object entity, object id, object[] values, IType[] types, IEventSource source)
        {
            WrapVisitor visitor = new WrapVisitor(source);

            // substitutes into values by side-effect
            visitor.ProcessEntityPropertyValues(values, types);
            return(visitor.SubstitutionRequired);
        }
コード例 #2
0
        protected virtual async Task <bool> VisitCollectionsBeforeSaveAsync(object entity, object id, object[] values, IType[] types, IEventSource source, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            WrapVisitor visitor = new WrapVisitor(source);

            // substitutes into values by side-effect
            await(visitor.ProcessEntityPropertyValuesAsync(values, types, cancellationToken)).ConfigureAwait(false);
            return(visitor.SubstitutionRequired);
        }
コード例 #3
0
        private bool WrapCollections(IEventSource session, IEntityPersister persister, IType[] types, object[] values)
        {
            if (persister.HasCollections)
            {
                // wrap up any new collections directly referenced by the object
                // or its components

                // NOTE: we need to do the wrap here even if its not "dirty",
                // because collections need wrapping but changes to _them_
                // don't dirty the container. Also, for versioned data, we
                // need to wrap before calling searchForDirtyCollections

                WrapVisitor visitor = new WrapVisitor(session);
                // substitutes into values by side-effect
                visitor.ProcessEntityPropertyValues(values, types);
                return(visitor.SubstitutionRequired);
            }
            else
            {
                return(false);
            }
        }