public CustomEntityDefinition( string kind, string listKind, string @group, string version, string singular, string plural, EntityScope scope) { Kind = kind; ListKind = listKind; Group = @group; Version = version; Singular = singular; Plural = plural; Scope = scope; }
public async Task<EntityList> InstallSchemaAsync(IApiContext apiContext, EntityList entityList, EntityScope scope, IndexedProperty idProperty,List<IndexedProperty> indexedProperties) { if (indexedProperties != null && indexedProperties.Count > 4) throw new Exception("Only 4 indexed properties are supported"); if (string.IsNullOrEmpty(entityList.Name)) throw new Exception("Entity name is missing"); entityList.TenantId = apiContext.TenantId; entityList.ContextLevel = scope.ToString(); if (indexedProperties != null) { entityList.IndexA = indexedProperties.Count >= 1 ? indexedProperties[0] : null; entityList.IndexB = indexedProperties.Count >= 2 ? indexedProperties[1] : null; entityList.IndexC = indexedProperties.Count >= 3 ? indexedProperties[2] : null; entityList.IndexD = indexedProperties.Count >= 4 ? indexedProperties[3] : null; } if (idProperty == null) entityList.UseSystemAssignedId = true; else entityList.IdProperty = idProperty; if (string.IsNullOrEmpty(entityList.NameSpace)) entityList.NameSpace = _appSetting.Namespace; var entityListResource = new EntityListResource(apiContext); var listFQN = GetListFQN(entityList.Name, entityList.NameSpace); var existing = await GetEntityListAsync(apiContext, entityList.Name); try { existing = existing != null ? await entityListResource.UpdateEntityListAsync(entityList, listFQN) : await entityListResource.CreateEntityListAsync(entityList); } catch (AggregateException ae) { if (ae.InnerException.GetType() == typeof(ApiException)) throw; var aex = (ApiException)ae.InnerException; _logger.Error(aex.Message, aex); throw aex; } return entityList; }
public async Task<EntityList> InstallSchemaAsync(IApiContext apiContext, EntityList entityList, EntityScope scope, List<IndexedProperty> indexedProperties) { return await InstallSchemaAsync(apiContext, entityList, scope, null, indexedProperties); }
public EntityScopeAttribute(EntityScope scope = default) { Scope = scope; }
public async Task <EntityList> InstallSchemaAsync(IApiContext apiContext, EntityList entityList, EntityScope scope, IndexedProperty idProperty, List <IndexedProperty> indexedProperties) { if (indexedProperties != null && indexedProperties.Count > 4) { throw new Exception("Only 4 indexed properties are supported"); } if (string.IsNullOrEmpty(entityList.Name)) { throw new Exception("Entity name is missing"); } entityList.TenantId = apiContext.TenantId; entityList.ContextLevel = scope.ToString(); if (indexedProperties != null) { entityList.IndexA = indexedProperties.Count >= 1 ? indexedProperties[0] : null; entityList.IndexB = indexedProperties.Count >= 2 ? indexedProperties[1] : null; entityList.IndexC = indexedProperties.Count >= 3 ? indexedProperties[2] : null; entityList.IndexD = indexedProperties.Count >= 4 ? indexedProperties[3] : null; } if (idProperty == null) { entityList.UseSystemAssignedId = true; } else { entityList.IdProperty = idProperty; } if (string.IsNullOrEmpty(entityList.NameSpace)) { entityList.NameSpace = _appSetting.Namespace; } var entityListResource = new EntityListResource(apiContext); var listFQN = GetListFQN(entityList.Name, entityList.NameSpace); var existing = await GetEntityListAsync(apiContext, entityList.Name); try { existing = existing != null ? await entityListResource.UpdateEntityListAsync(entityList, listFQN) : await entityListResource.CreateEntityListAsync(entityList); } catch (AggregateException ae) { if (ae.InnerException.GetType() == typeof(ApiException)) { throw; } var aex = (ApiException)ae.InnerException; _logger.Error(aex.Message, aex); throw aex; } return(entityList); }
public async Task <EntityList> InstallSchemaAsync(IApiContext apiContext, EntityList entityList, EntityScope scope, List <IndexedProperty> indexedProperties) { return(await InstallSchemaAsync(apiContext, entityList, scope, null, indexedProperties)); }