public static UpgradeSystemService CreateAndInitialize(StatefulServiceInitializationParameters initParams)
        {
            var replica = new UpgradeSystemService(
                initParams.CodePackageActivationContext.WorkDirectory,
                initParams.PartitionId);

            replica.InitializeKvs(initParams);

            return(replica);
        }
        IStatefulServiceReplica IStatefulServiceFactory.CreateReplica(
            string serviceTypeName,
            Uri serviceName,
            byte[] initializationData,
            Guid partitionId,
            long replicaId)
        {
            var initParams = new StatefulServiceInitializationParameters(FabricRuntime.GetActivationContext())
            {
                ServiceTypeName    = serviceTypeName,
                ServiceName        = serviceName,
                InitializationData = initializationData,
                PartitionId        = partitionId,
                ReplicaId          = replicaId,
            };

            return(UpgradeSystemService.CreateAndInitialize(initParams));
        }