diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/DBViewContextWrapper.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/DBViewContextWrapper.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/DBViewContextWrapper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/DBViewContextWrapper.cs new file mode 100644 index 000000000..231c27bf2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/DBViewContextWrapper.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; + +namespace Tango.MachineStudio.Developer.ViewModels +{ + public class DBViewContextWrapper<T> where T : class, IObservableEntity + { + public T EditEntity { get; set; } + + public ObservablesEntitiesAdapter Adapter { get; set; } + + public DBViewContextWrapper() + { + Adapter = ObservablesEntitiesAdapter.Instance; + } + + public DBViewContextWrapper(T entity) : this() + { + EditEntity = entity; + } + + public static implicit operator DBViewContextWrapper<T>(T entity) + { + return new DBViewContextWrapper<T>(entity); + } + + public static implicit operator T(DBViewContextWrapper<T> instance) + { + return instance.EditEntity; + } + } +} |
