public async Task CreateAsync(Concept concept)
        {
            try
            {
                var conceptClass = new ConceptClass()
                {
                    Id = Guid.NewGuid(), CreatedOn = 44, Version = 1
                };

                await _collection.InsertOneAsync(conceptClass);
            }
            catch (MongoWriteException ex)
            {
                if (ex.IsUniqueViolation())
                {
                    throw Error.UniqueKey(ex);
                }
                throw Error.GenericDb(ex);
            }
            catch (MongoCommandException ex)
            {
                Debug.WriteLine(ex);
                throw Error.GenericDb(ex);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                throw;
            }
        }
示例#2
0
        public ConceptClass InsertConceptClass(ConceptClass conceptClass)
        {
            var persistenceService = ApplicationContext.Current.GetService <IDataPersistenceService <ConceptClass> >();

            if (persistenceService == null)
            {
                throw new InvalidOperationException($"{nameof(IDataPersistenceService<ConceptClass>)} not found");
            }

            return(persistenceService.Insert(conceptClass, AuthenticationContext.Current.Principal, TransactionMode.Commit));
        }
示例#3
0
 ConceptClass IConceptRepositoryService.SaveConceptClass(ConceptClass conceptClass)
 {
     throw new NotImplementedException();
 }
示例#4
0
 public Concept SaveConceptClass(ConceptClass clazz)
 {
     throw new NotImplementedException();
 }
示例#5
0
 public ConceptClass InsertConceptClass(ConceptClass conceptClass)
 {
     throw new NotImplementedException();
 }