Ejemplo n.º 1
0
        public static void For <T>(this MongoDBGrainStorageOptions originalOptions,
                                   Action <MongoDBGrainStorageOptions> newOptions)
        {
            if (originalOptions.ForType == null)
            {
                originalOptions.ForType = new Dictionary <string, MongoDBGrainStorageOptions>();
            }
            var typeOptions = (MongoDBGrainStorageOptions)originalOptions.Clone();

            newOptions(typeOptions);
            originalOptions.ForType.Add(typeof(T).FullName, typeOptions);
        }
Ejemplo n.º 2
0
        public static string DefaultCollectionNameResolver(string grainType,
                                                           MongoDBGrainStorageOptions options,
                                                           IGrainState grainState,
                                                           GrainReference grainReference)
        {
            if (options.StripFromGrainName != null)
            {
                grainType = grainType.Replace(options.StripFromGrainName, "");
            }
            else
            {
                grainType = grainType.Split('.', '+').Last();
            }

            if (options.StripGrainFromCollectionName)
            {
                grainType = grainType.Replace("Grain", "");
            }

            return(options.CollectionPrefix + grainType);
        }
Ejemplo n.º 3
0
 public MongoDBGrainStorageOptionsValidator(IOptions <MongoDBGrainStorageOptions> options, string name)
 {
     this.options = options.Value;
     this.name    = name;
 }