V
V
VanilaSpirit2020-06-30 01:03:13
ASP.NET
VanilaSpirit, 2020-06-30 01:03:13

How to process db records in realtime ASP.NET Core?

There is adding/editing/deleting records to the database through pages, it would be great to make it so that when changing a record on one of the pages, they are automatically updated/added to others.
How can this be implemented? Can I see examples somewhere?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stanislav Makarov, 2020-06-30
@Nipheris

Read about websockets. You will need to keep connections from pages in the browser to your server, and send updates to all clients that are "subscribed" to certain records when these same records change.
The task is not as trivial as it seems - you need to understand how the resulting solution will scale, and how the amount of data sent will be limited. And in general, "it would be great" is an insufficient argument, such a task must be set consciously, understanding the future costs and expenses.
Well, also look at SignalR as a more complex solution (if you are sure that this is not overkill for you - bare web sockets may be better for learning purposes).

I
itgood, 2020-06-30
@itgood

обновление бд
namespace Test_project
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Entity.Spatial;

    public partial class order_accounting_teh
    {
        [Key]
        [Column("Номер_заказа ", Order = 0)]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int Номер_заказа_ { get; set; }

        [Key]
        [Column("Ед.изм.", Order = 1)]
        [StringLength(100)]
        public string Ед_изм_ { get; set; }

        [Key]
        [Column("Дата  выдачи сырья", Order = 2, TypeName = "date")]
        public DateTime Дата__выдачи_сырья { get; set; }

        [Column("Дата изменения", TypeName = "date")]
        public DateTime? Дата_изменения { get; set; }

        [Key]
        [Column(Order = 3)]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int П_П { get; set; }

        [Key]
        [Column("Обозначение/Наименование", Order = 4)]
        [StringLength(255)]
        public string Обозначение_Наименование { get; set; }

        [Key]
        [Column("Наименование сырья", Order = 5)]
        [StringLength(255)]
        public string Наименование_сырья { get; set; }

        [Key]
        [Column("Кол-во,шт", Order = 6)]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int Кол_во_шт { get; set; }

        [Column("Номер заказчика")]
        public int? Номер_заказчика { get; set; }
    }
}

here it is filled through the datagrid, only changes are made immediately to the database, auto-saving is in progress

V
Vladimir Korotenko, 2020-06-30
@firedragon

As already mentioned above, sockets, signal, can be LongPooling.
I did something to notify a person about a new message and add information to the chat.
https://github.com/vkorotenko/ChatApplication

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question