Example #1
0
        public void Test()
        {
            // Creation of a new entity.
            var sample1 = new SampleEntity1();

            sample1.Value = 3;

            //// EntityGate support and database registration.
            var gate = new EntityGateObject <SampleEntity1>(sample1);

            if (gate.Save())
            {
                // New data saved in database.
            }

            // Creation of a new entity.
            gate.NewEntity();
            gate.Entity.Value = 4;
            gate.Save();

            // Loading the primary key "10" and obtaining the entity.
            gate.Load(identifier: 10);
            sample1 = gate.Entity;

            // Support for another entity.
            var gate2 = new EntityGateObject <OtherEntity>();

            // Loading the primary key "33"...
            if (gate2.Load(33))
            {
                // ...and obtaining the entity.
                OtherEntity sample2 = gate2.Entity;
            }
        }
        protected override void DeclareEntities()
        {
            var sampleEntity = new SampleEntity();

            sampleEntity.Id    = new Guid("1dd672d5-b66e-4377-ba4a-f541c44c9a5e");
            sampleEntity.Emrah = "emrah";
            AddCollection(sampleEntity);

            var sampleEntity1 = new SampleEntity();

            sampleEntity1.Emrah = "emrah1";
            AddCollection(sampleEntity1);

            var sampleEntity2 = new SampleEntity();

            sampleEntity2.Emrah = "emrah2";
            AddCollection(sampleEntity2);

            var ent2 = new SampleEntity1();

            ent2.Emrah = "fatih";
            AddCollection(ent2);
        }
Example #3
0
        public async Task UpdateEntity(int id, SampleEntity1 updatedEntity)
        {
            var entityToUpdate = await _repository.Get(id);

            await _repository.Update(updatedEntity, entityToUpdate);
        }
Example #4
0
 public async Task CreateEntity(SampleEntity1 entity)
 {
     await _repository.Add(entity);
 }