implements a read only data access,
data that is not intent to be changed
This commit is contained in:
parent
5a38ce23e5
commit
45c5c1b57b
1 changed files with 24 additions and 0 deletions
24
BookAStar/BookAStar/Helpers/RemoteEntityRO.cs
Normal file
24
BookAStar/BookAStar/Helpers/RemoteEntityRO.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using BookAStar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BookAStar.Helpers
|
||||
{
|
||||
class RemoteEntityRO<V,K>: RemoteEntity<V,K> where K: IEquatable<K>
|
||||
{
|
||||
public RemoteEntityRO (string controllerName,
|
||||
Func<V,K> getKey) : base(controllerName,getKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void UpdateOrAdd(V item)
|
||||
{
|
||||
var key = GetKey(item);
|
||||
if (this.Any(x => GetKey(x).Equals(key))) { return; }
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue