예제 #1
0
        private static async Task <string?> CheckAppAsync(IAppsByNameIndexGrain index, CreateApp command)
        {
            var name = command.Name;

            if (name.IsSlug())
            {
                var token = await index.ReserveAsync(command.AppId, name);

                if (token == null)
                {
                    throw new ValidationException(T.Get("apps.nameAlreadyExists"));
                }

                return(token);
            }

            return(null);
        }
예제 #2
0
        private static async Task <string?> CheckAppAsync(IAppsByNameIndexGrain index, CreateApp command)
        {
            var name = command.Name;

            if (name.IsSlug())
            {
                var token = await index.ReserveAsync(command.AppId, name);

                if (token == null)
                {
                    var error = new ValidationError("An app with this already exists.");

                    throw new ValidationException("Cannot create app.", error);
                }

                return(token);
            }

            return(null);
        }
        public OrleansAppsHealthCheck(IGrainFactory grainFactory)
        {
            Guard.NotNull(grainFactory, nameof(grainFactory));

            index = grainFactory.GetGrain <IAppsByNameIndexGrain>(SingleGrain.Id);
        }