From e85821ce66a2f591a4751852e1b74de4601a01a5 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 18 Sep 2016 00:21:27 +0200 Subject: [PATCH] implements a read only data access, data that is not intent to be changed --- BookAStar/BookAStar/Helpers/RemoteEntityRO.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 BookAStar/BookAStar/Helpers/RemoteEntityRO.cs diff --git a/BookAStar/BookAStar/Helpers/RemoteEntityRO.cs b/BookAStar/BookAStar/Helpers/RemoteEntityRO.cs new file mode 100644 index 00000000..9688d23d --- /dev/null +++ b/BookAStar/BookAStar/Helpers/RemoteEntityRO.cs @@ -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: RemoteEntity where K: IEquatable + { + public RemoteEntityRO (string controllerName, + Func 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); + } + } +}