示例#1
0
 public frmMain(IServiceActor serviceActor, IServiceFilm serviceFilm, IServiceDirector serviceDirector, IServiceFilmType serviceFilmType, IServiceProducer serviceProducer, IServiceUser serviceUser, IServiceWriter serviceWriter)
 {
     _serviceActor    = serviceActor;
     _serviceFilm     = serviceFilm;
     _serviceDirector = serviceDirector;
     _serviceFilmType = serviceFilmType;
     _serviceProducer = serviceProducer;
     _serviceUser     = serviceUser;
     _serviceWriter   = serviceWriter;
     InitializeComponent();
 }
示例#2
0
 public frmMain(IServiceActor serviceActor, IServiceFilm serviceFilm, IServiceDirector serviceDirector, IServiceFilmType serviceFilmType, IServiceProducer serviceProducer, IServiceUser serviceUser, IServiceWriter serviceWriter)
 {
     _serviceActor = serviceActor;
     _serviceFilm = serviceFilm;
     _serviceDirector = serviceDirector;
     _serviceFilmType = serviceFilmType;
     _serviceProducer = serviceProducer;
     _serviceUser = serviceUser;
     _serviceWriter = serviceWriter;
     InitializeComponent();
 }
        protected override Task ExecuteAsync(CancellationToken stoppingToken)
        {
            var conf = new ConsumerConfig
            {
                GroupId          = "Films-consumer",
                BootstrapServers = "host.docker.internal:9094",
                AutoOffsetReset  = AutoOffsetReset.Earliest
            };

            using (var c = new ConsumerBuilder <Ignore, string>(conf).Build())
            {
                c.Subscribe("films");
                var cts = new CancellationTokenSource();
                try
                {
                    while (true)
                    {
                        var message = c.Consume(cts.Token);

                        Films F = new Films();

                        var serializeOptions = new JsonSerializerOptions
                        {
                            PropertyNamingPolicy = JsonNamingPolicy.CamelCase
                        };

                        F = JsonSerializer.Deserialize <Films>(message.Value, serializeOptions);

                        using (var scope = _serviceScopeFactory.CreateScope())
                        {
                            service = scope.ServiceProvider.GetService <IServiceFilm>();
                            service.Create(F);
                        }
                    }
                }
                catch (OperationCanceledException)
                {
                    c.Close();
                }
            }
            return(Task.CompletedTask);
        }
示例#4
0
 public FilmController(IServiceFilm serviceFilm,IServiceActor serviceActor)
 {
     _serviceFilm = serviceFilm;
     _serviceActor = serviceActor;
 }
示例#5
0
        public FilmController(IServiceFilm serviceFilm)

        {
            _iServiceFilm = serviceFilm;
        }
示例#6
0
 public FilmController(IServiceFilm serviceFilm, IServiceActor serviceActor)
 {
     _serviceFilm  = serviceFilm;
     _serviceActor = serviceActor;
 }
示例#7
0
 public FilmController(IServiceFilm serviceFilm)
 {
     _serviceFilm = serviceFilm;
 }
 public ControllerFilm(IServiceFilm _service)
 {
     this.service = _service;
 }