public static Member Get(Apache.Geode.Client.IRegion <string, string> region, string email)
        {
            if (region == null || string.IsNullOrEmpty(email))
            {
                throw new ArgumentNullException();
            }

            string name = null;

            try {
                if (!region.TryGetValue(email, out name))
                {
                    throw new NullReferenceException("Key does not exist");
                }
            }
            catch (Exception ex) {
                throw new GetMemberException("Error getting member", ex);
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new NullReferenceException("Key does not exist");
            }

            Member m = new Member()
            {
                fullName = name,
                email    = email
            };

            return(m);
        }
        public static Member Add(Apache.Geode.Client.IRegion <string, string> region, Member member, bool exceptionOnExists = true)
        {
            if (region == null || member == null)
            {
                throw new ArgumentNullException();
            }

            try {
                string tmp;

                /*  if (region.TryGetValue(member.email, out tmp)) {
                 *  if (exceptionOnExists) {
                 *      throw new MemberAccessException();
                 *  }
                 *
                 *  return Get(region, member.email);
                 *  }*/

                region[member.email] = member.fullName;
            }
            catch (Exception ex) {
                throw new AddMemberException("Error add member", ex);
            }

            return(Get(region, member.email));
        }
        public static Apache.Geode.Client.IRegion <string, string> Initalize(string name, Apache.Geode.Client.Cache cache)
        {
            if (string.IsNullOrEmpty(name) || cache == null)
            {
                throw new ArgumentNullException();
            }

            Apache.Geode.Client.RegionFactory            regionFactory = cache.CreateRegionFactory(Apache.Geode.Client.RegionShortcut.PROXY);
            Apache.Geode.Client.IRegion <string, string> region        = regionFactory.Create <string, string>(name);

            return(region);
        }
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            cache = Models.Cache.Initalize();

            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }

            region = Models.Region.Initalize("memberRegion", cache);

            if (region == null)
            {
                throw new ArgumentNullException("region");
            }
        }
        public static void Update(Apache.Geode.Client.IRegion <string, string> region, string email, Member member)
        {
            if (region == null || string.IsNullOrEmpty(email) || member == null)
            {
                throw new ArgumentNullException();
            }

            try {
                string tmp;
                if (!region.TryGetValue(email, out tmp))
                {
                    throw new NullReferenceException();
                }

                region[email] = member.fullName;
            } catch (Exception ex) {
                throw new RemoveMemberException("Error getting member", ex);
            }

            return;
        }
 public override void Close(Apache.Geode.Client.IRegion <Object, Object> region)
 {
 }