/// <summary>
        /// Создать объект, где хранятся данные сущности "DummyManyToMany".
        /// </summary>
        /// <returns>Объект, где хранятся данные сущности "DummyManyToMany".</returns>
        public DataBaseObjectDummyManyToMany CreateObjectDummyManyToMany()
        {
            var loader = new DataBaseLoaderDummyManyToMany();

            loader.LoadDataFrom(this);
            return(loader.Data);
        }
Ejemplo n.º 2
0
        private async Task <DataBaseObjectDummyManyToMany> SaveObjectDummyManyToMany(
            DataBaseObjectDummyManyToMany obj
            )
        {
            DataBaseObjectDummyManyToMany result = null;

            using (var source = CreateDbContext())
            {
                if (obj.Id > 0)
                {
                    result = await source.DummyManyToMany
                             .FirstAsync(x => x.Id == obj.Id)
                             .CoreBaseExtTaskWithCurrentCulture(false);

                    var loader = new DataBaseLoaderDummyManyToMany(result);

                    loader.LoadDataFrom(obj);
                }
                else
                {
                    var entity = DataEntityObjectDummyManyToMany.Create(obj);

                    var entry = source.DummyManyToMany.Add(DataEntityObjectDummyManyToMany.Create(obj));

                    result = entry.Entity;
                }

                await source.SaveChangesAsync().CoreBaseExtTaskWithCurrentCulture(false);
            }

            return(result);
        }