Esempio n. 1
0
        public IManagedPlatform GetPlatformByDatabaseId(string id)
        {
            using (Profiler.Measure("PlatformService.GetPlatformByDatabaseId"))
            {
                if (string.IsNullOrEmpty(id))
                {
                    throw new ArgumentNullException("id");
                }

                var platform = CastEntityHelper.GetEntityByField <ManagedPlatform>(new EntityRef(ManagedPlatformSchema.DatabaseIdField), id);

                if (platform != null)
                {
                    // pre-load? may be doing this wrong. i forget how to check it.
                    EntityRepository.Get <ManagedPlatform>(platform.Id, ManagedPlatform.ManagedPlatformPreloadQuery);
                }

                return(platform);

                //return CastQueryHelper.GetEntityByFieldValue<ManagedPlatform>(
                //    new EntityRef(ManagedPlatform.ManagedPlatformType),
                //    new EntityRef(ManagedPlatform.DatabaseIdField),
                //    id, preloadQuery: ManagedPlatform.ManagedPlatformPreloadQuery);
            }
        }
Esempio n. 2
0
 public IManagedAppVersion GetAppVersion(Guid appVersionId)
 {
     using (Profiler.Measure("PlatformService.GetAppVersion"))
     {
         return(CastEntityHelper.GetEntityByField <ManagedAppVersion>(new EntityRef(ManagedAppVersionSchema.AppVersionIdField), appVersionId.ToString("B")));
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Gets the product that is identified by the given sku.
        /// </summary>
        /// <param name="sku">The stock keeping unit.</param>
        /// <returns>The marketplace product.</returns>
        public IMarketplaceProduct GetProduct(string sku)
        {
            using (Profiler.Measure("MarketplaceService.GetProduct"))
            {
                if (string.IsNullOrEmpty(sku))
                {
                    throw new ArgumentNullException("sku");
                }

                return(CastEntityHelper.GetEntityByField <MarketplaceProduct>(new EntityRef(MarketplaceProductSchema.SkuField), sku));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Gets information about a tenant with the given name.
        /// </summary>
        /// <param name="name">The tenant name.</param>
        /// <returns>A tenant info object.</returns>
        public RemoteTenantInfo GetTenant(string name)
        {
            using (Profiler.Measure("TenantService.GetTenant"))
            {
                using (new GlobalAdministratorContext())
                {
                    var tenant = CastEntityHelper.GetEntityByField <TenantModel>(new EntityRef(TenantModel.Name_Field), name);

                    if (tenant == null)
                    {
                        return(null);
                    }

                    return(GetTenantInfo(tenant));
                }
            }
        }