示例#1
0
        private Task EnsureUniqueIndex(Type sagaDataType, string propertyName)
        {
            if (propertyName == null)
            {
                return(Task.FromResult(0));
            }

            var classmap        = BsonClassMap.LookupClassMap(sagaDataType);
            var uniqueFieldName = GetFieldName(classmap, propertyName);

            return(_repo.EnsureUniqueIndex(sagaDataType, uniqueFieldName));
        }
示例#2
0
        private void EnsureUniqueIndex(IContainSagaData saga)
        {
            var sagaDataType   = saga.GetType();
            var uniqueProperty = UniqueAttribute.GetUniqueProperty(sagaDataType);

            if (uniqueProperty == null)
            {
                return;
            }

            var classmap        = BsonClassMap.LookupClassMap(sagaDataType);
            var uniqueFieldName = GetFieldName(classmap, uniqueProperty.Name);

            _repo.EnsureUniqueIndex(sagaDataType, uniqueFieldName);
        }