c# - IEntity where Key/ID type unknown -


i've been exploring use of data repositories in c# i'm working on first "big" application in quite time (and first c#). particularly used information http://web.archive.org/web/20150404154203/https://www.remondo.net/repository-pattern-example-csharp/ msdn , stackoverflow.

i seem have gotten stuck @ think may quite simple, i've tried googling, etc. , either it's more complex thought, or i'm using wrong terminology.

basically, when defining ientity interface this:

namespace test.database {     public interface ientity     {          int keyvalue { get; set; }     } } 

that works great things, project using existing, nasty database (hence why i'm trying abstract business logic , other dev's future business logic far possible db) not keys integer. there keys character, integers, doubles, etc. there way can make interface's key property, type-agnostic? or looking @ whole thing wrong way?

you use generics make typed based on situation. ex.,

namespace test.database {     public interface ientity<t>     {          t keyvalue { get; set; }     } } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -