Hi,
   I am trying to expose Cache contents as an Odata API. I created the
Odata API using ASP.NET WebAPI. Inside the API implementation, I am
initializing Ignite in cache mode. Below is the method I am using to
retrieve a listing. I have 2 questions.

1. I was not able to use Select option in AsCacheQueryable. How to get a
list of all the entries in the cache from LINQ?
2. Embedded IIS server quits the process after it hits var ignite =
Ignition.Start(cfg); statement. Processing stops beyond this statement. I
confirmed this in debug mode. It does not throw any errors in the console.
Not sure if it is possible to start Ignite in client mode in Web API that
is deployed on IIS.

Any help will be much appreciated. Thanks.

public List<Movie> GetMovies()
        {
            var cfg = new IgniteConfiguration
            {
                BinaryConfiguration = new
Apache.Ignite.Core.Binary.BinaryConfiguration(typeof(Movie),
typeof(StarRating), typeof(Person)),
                JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
            };
            Ignition.ClientMode = true;
            var ignite = Ignition.Start(cfg);
            var cache = ignite.GetOrCreateCache<int, Movie>(new
CacheConfiguration
            {
                Name = "myMusicCache",
                QueryEntities = new[]
            {
                        new QueryEntity(typeof(int), typeof(Movie))

                    }
            });
            List<Movie> movies = new List<Movie>();
            IQueryable<ICacheEntry<int, Movie>> qry =
                cache.AsCacheQueryable().Where(m => m.Key == 1);

            foreach (ICacheEntry<int, Movie> entry in qry)
            {
                Console.WriteLine("Movie: " + entry.Value);
                movies.Add(entry.Value);
            }


            return movies;
        }

Reply via email to