Beispiel #1
0
        public void ApiResourceEntityToModelConfigurationIsValid()
        {
            var model = new ApiResource();

            // TODO: set references

            var mappedModel  = model.ToModel();
            var mappedEntity = mappedModel.ToEntity();

            Assert.NotNull(mappedModel);
            Assert.NotNull(mappedEntity);
            ApiResourceMappers.Mapper.ConfigurationProvider.AssertConfigurationIsValid();
        }
        public ApiResourceDto GetApiResourceDto(int?id)
        {
            ApiResourceDto apiResourceDto = new ApiResourceDto();

            if (!id.HasValue)
            {
                return(apiResourceDto);
            }
            if (id.Value <= 0)
            {
                return(apiResourceDto);
            }
            ApiResource apiResource = this.Session.Get <ApiResource>(id.Value);

            apiResource.UserClaims = this.Session.CreateCriteria <ApiClaim>()
                                     .Add(NHibernate.Criterion.Restrictions.Eq("ApiResourceId", id.Value))
                                     .List <ApiClaim>()
                                     .ToList();

            return(apiResource.ToModel());
        }