コード例 #1
0
        public async Task <Guid> Save(UserProfileModel userProfileModel)
        {
            if (userProfileModel.Id == Guid.Empty || userProfileModel.Id == null)
            {
                userProfileModel.Id = Guid.NewGuid();
            }

            var entity = _dataEntityObjectFactory.Create();

            entity.Id = userProfileModel.Id;

            entity.Set("id", userProfileModel.Id.ToString());
            entity.Set("name", userProfileModel.Username);

            await AnyThread(() => _userProfileRepository.Insert(entity));

            return(userProfileModel.Id);
        }
コード例 #2
0
        public async Task <IEnumerable <IDataEntityObject> > Select(string from)
        {
            var results = await _db.RunQueryAsync(new Query(from)).ConfigureAwait(false);

            var returnData = new List <IDataEntityObject>();

            foreach (var result in results.Entities)
            {
                var entity = _dataEntityObjectFactory.Create();

                foreach (var prop in result.Properties)
                {
                    //TODO: Get actually type from property
                    entity.Set(prop.Key, prop.Value.StringValue);
                }
                returnData.Add(entity);
            }

            return(returnData);
        }