/// <summary>
            /// Register the feature
            /// </summary>
            /// <param name="createProxy"></param>
            private void Register(bool createProxy)
            {
                var featureType = _featureConfiguration.GetType();

                var serviceType = _fluentConfiguration._assemblyTypes
                                  .Where(x => x
                                         .GetConstructors()
                                         .Any(ctor => ctor
                                              .GetParameters()
                                              .Any() &&
                                              ctor
                                              .GetParameters()
                                              .All(param => param.ParameterType == featureType)))
                                  .Distinct()
                                  .SingleOrDefault();

                var interfaceType = serviceType.GetInterfaces().FirstOrDefault();

                object service = Activator.CreateInstance(serviceType, _featureConfiguration);

                if (createProxy)
                {
                    service = FeatureClient.CreateProxy(service, interfaceType, _featureConfiguration);
                }

                _fluentConfiguration._registrationCallback(interfaceType, () => service);
            }
        public FeatureClient GetFeatureClient(RecordedDelegatingHandler handler)
        {
            var token = new TokenCloudCredentials(Guid.NewGuid().ToString(), "abc123");
            handler.IsPassThrough = false;
            var client = new FeatureClient(token).WithHandler(handler);

            HttpMockServer.Mode = HttpRecorderMode.Playback;
            return client;
        }
        public FeatureClient GetFeatureClient(RecordedDelegatingHandler handler)
        {
            var token = new TokenCloudCredentials(Guid.NewGuid().ToString(), "abc123");

            handler.IsPassThrough = false;
            var client = new FeatureClient(token).WithHandler(handler);

            HttpMockServer.Mode = HttpRecorderMode.Playback;
            return(client);
        }
Exemplo n.º 4
0
        public FeatureClient GetFeatureClient(RecordedDelegatingHandler handler)
        {
            var subscriptionId = Guid.NewGuid().ToString();
            var token          = new TokenCredentials(subscriptionId, "abc123");

            handler.IsPassThrough = false;
            var client = new FeatureClient(token, handler);

            client.SubscriptionId = subscriptionId;
            HttpMockServer.Mode   = HttpRecorderMode.Playback;
            return(client);
        }
Exemplo n.º 5
0
 public string insertFeature(FeatureClient item)
 {
     try
     {
         item.Insert();
         return(itemToJson(item));
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Exemplo n.º 6
0
        public string itemToJson(FeatureClient _user)
        {
            Response response = new Response();

            response.Error = _user.Error;
            if (_user.Result)
            {
                response.item    = _user;
                response.Success = true;
            }
            else
            {
                response.Success = false;
            }
            return(JsonConvert.SerializeObject(response));
        }
Exemplo n.º 7
0
 public string selectTable(FeatureClient item)
 {
     try
     {
         item.SelectTable();
         if (item.Error == "")
         {
             return(tabletoJson(item.Data.Tables[ObjetosGenerales.TABLA_FCLIENTS]));
         }
         else
         {
             return(item.Error);
         }
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }