Beispiel #1
0
        public async System.Threading.Tasks.Task <T> UpdateAsync(T updated, long id)
        {
            T t = await AsyncSession.LoadAsync <T>(EntityUtility.GetRecordId <T>(id));

            t.CopyPropertiesFrom(updated);
            //t.Properties = updated.Properties;
            t.Id = id;
            return(t);
        }
Beispiel #2
0
        public T Update(T updated, long id)
        {
            T t = Session.Load <T>(EntityUtility.GetRecordId <T>(id));

            t.CopyPropertiesFrom(updated);
            //t.Properties = updated.Properties;
            t.Id = id;
            return(t);
        }
Beispiel #3
0
        public async System.Threading.Tasks.Task <int> DeleteAsync(long id)
        {
            int count    = 0;
            var existing = await AsyncSession.LoadAsync <T>(EntityUtility.GetRecordId <T>(id));

            if (existing != null)
            {
                count = 1;
                AsyncSession.Delete(existing);
            }
            return(count);
        }
Beispiel #4
0
        public int Delete(long id)
        {
            int count    = 0;
            var existing = Session.Load <T>(EntityUtility.GetRecordId <T>(id));

            if (existing != null)
            {
                count = 1;
                Session.Delete(existing);
            }
            return(count);
        }
Beispiel #5
0
        public Task <T[]> GetAsync(long[] ids)
        {
            var array = ids.Select(id => EntityUtility.GetRecordId <T>(id)).ToArray();

            return(AsyncSession.LoadAsync <T>(array));
        }
Beispiel #6
0
        public T[] Get(long[] ids)
        {
            var array = ids.Select(id => EntityUtility.GetRecordId <T>(id)).ToArray();

            return(Session.Load <T>(array));
        }
Beispiel #7
0
 public async System.Threading.Tasks.Task <T> GetAsync(long id)
 {
     return(await AsyncSession.LoadAsync <T>(EntityUtility.GetRecordId <T>(id)));
 }
Beispiel #8
0
 public T Get(long id)
 {
     return(Session.Load <T>(EntityUtility.GetRecordId <T>(id)));
 }