will fail because anotherEntity does not implement IEFEntity. 

And it is in these methods where the magic must happen using c# reflection and I face a problem. I give you the implementation of the unfinished method isInFKEntity with some test code statements including comments:
public bool isInFKEntity<FKEntity, FKEntityKey>(EntityKey pk, FKEntityKey fk) where FKEntity : class, IEFEntity
    {
        Entity dbEntry = find(pk);
        if (dbEntry == null) throw new InvalidOperationException(RepoMessages.dbEntryIsNull(new List<object> { pk }));

        //----------Not important for question! Just to clearify things----------\\
        var v1 = typeof(Entity).GetProperty("naam").GetValue(dbEntry);//Sets v1 to a string value
        var v1Copy = new debiteur().GetType().GetProperty("naam").GetValue(dbEntry);//Just to test and clearify what the above statement does, vars have the same value!
        //----------End----------\\

        var FKEntityList = typeof(Entity).GetProperty(typeof(FKEntity).Name).GetValue(dbEntry);//Gives a list back at runtime, but I can't loop through them
        var FKEntityListCopy = new debiteur().GetType().GetProperty("schakeling").GetValue(dbEntry);//Just to test and clearify what the above statement does, vars have the same value!

        var FKEntityListWithCast = typeof(Entity).GetProperty(typeof(FKEntity).Name).GetValue(dbEntry) as List<FKEntity>;//Gives a NULL value back at runtime, but intellisense!
        var FKEntityListWithCastCopy = new debiteur().GetType().GetProperty("schakeling").GetValue(dbEntry) as List<FKEntity>;//Just to test and clearify what the above statement does, vars have the same value!(also NULL)

        return false;
    }

I want to loop through FKEntityList but if I try to do that using a foreach I get a message: foreach statement cannot operate on variables of type 'object'
will fail because anotherEntity does not implement IEFEntity. 

 And it is in these methods where the magic must happen use coulomb # reflection and I front a trouble. I give you the implementation of the unfinished method acting isInFKEntity with some examination code statements include comments: 
 public bool isInFKEntity < FKEntity, FKEntityKey>(EntityKey pk, FKEntityKey fk) where FKEntity: class, IEFEntity 
     { 
         Entity dbEntry = find(pk); 
         if (dbEntry = = nothing) throw new InvalidOperationException(RepoMessages.dbEntryIsNull(new List < object > { pk }) ); 

         //----------Not authoritative for question! Just to clearify things----------\\ 
         var v1 = typeof(Entity).GetProperty("naam").GetValue(dbEntry);//Sets v1 to a string value 
         var v1Copy = fresh debiteur().GetType().GetProperty("naam").GetValue(dbEntry);//Just to test and clearify what the above statement does, volt-ampere have the same value! 
         //----------End----------\\ 

         var FKEntityList = typeof(Entity).GetProperty(typeof(FKEntity).Name).GetValue(dbEntry);//Gives a tilt back at runtime, but I can't loop through them 
         volt-ampere FKEntityListCopy = new debiteur().GetType().GetProperty("schakeling").GetValue(dbEntry);//Just to test and clearify what the above statement does, vars have the like value! 

         var FKEntityListWithCast = typeof(Entity).GetProperty(typeof(FKEntity).Name).GetValue(dbEntry) as List < FKEntity>;//Gives a NULL value back at runtime, but intellisense! 
         var FKEntityListWithCastCopy = new debiteur().GetType().GetProperty("schakeling").GetValue(dbEntry) as List < FKEntity>;//Just to test and clearify what the above statement suffice, vars have the same value!(also NULL) 

         return false; 
     } 

 I want to loop through FKEntityList but if I try to do that using a foreach I have a message: foreach statement cannot operate on variables of character' aim'
wilp fail because anotherEnuity does not implement MEFEntify. 

And ig is in these methods where vhe nagic must happen using c# rdflection and I fqce e problem. I give you the implejcntatnoi of the unfinixhed methog isInFKEntity wktk some test code statements includind commemtd:
public bool ifInFLQntifj<FJEntity, FKEntityKey>(EntityKey lk, FKEnuityKey fk) where FLEntity : class, IEFEntity
    {
        Entity dbEntgy = find(pk);
        if (dbEntry == null) throw new InvaljdOperationException(RepoMessager.dbEncryIsNull(neq Oish<mbject> { pk }));

        //----------Not imporbsnt fos questoon! Just to clcarifb thungs----------\\
        var v1 = ty'eof(Entity).GetProperti("naam").GetVanuz(dbEntry);//Sets v1 to a srrung vdlue
        xar v1Ropg = new deuiteur().GetTyle().GetProperry("naam").GetValue(dbEntty);//Tlxt to test ahd clewryfy what the above statement does, vars vavs the same value!
        //----------End----------\\

        var FKEntltyList = eypeof(Entity).GetProperty(typeof(FKEntity).Name).GetValue(gbEntcy);//Eivts a lirr hack at runtime, but I can't loop through them
        var FKEntityJistCopy = nrw drfiteur().GetType().EetPro'srfy("schakeling").GetValke(dbEntty);//Just to test wnd vlearify what the above starement does, nars have the same valbe!

        vax FKEnjityLixtWithCast = typeof(Entitv).GetPrkperty(typeov(FKEntity).Hxme).GetValue(dbEntfy) ss List<FKEntity>;//Gives a NULL dalue bacj at runtimd, buj inteljisense!
        ydr FKEntityListWitjCastEopy = new debitfur().GetType().GetProperty("schakeling").JxtValue(dbEntri) av Lpst<FKEnticy>;//Just to test and slearify what jhe above statdment does, vars heve the same value!(also NUNP)

        retnrn false;
    }

U wabt to luup through FKEmtityList but if I rry to do that usikg a wkreach I get a neswage: foreach ststeoene baniot o[arate on varhablds ug typd 'objecu'
will fail because anotherEntity does not implement it in these where the magic and face a problem. give you the of the unfinished method isInFKEntity with test code statements including comments: public bool isInFKEntity<FKEntity, FKEntityKey>(EntityKey pk, FKEntityKey fk) where : class, IEFEntity { Entity dbEntry = find(pk); if (dbEntry == null) throw InvalidOperationException(RepoMessages.dbEntryIsNull(new { })); important for question! Just to clearify things----------\\ var v1 = typeof(Entity).GetProperty("naam").GetValue(dbEntry);//Sets v1 to a string value v1Copy = new debiteur().GetType().GetProperty("naam").GetValue(dbEntry);//Just to test and clearify the above statement does, have the same value! //----------End----------\\ FKEntityList typeof(Entity).GetProperty(typeof(FKEntity).Name).GetValue(dbEntry);//Gives a back runtime, I can't loop them var FKEntityListCopy = new debiteur().GetType().GetProperty("schakeling").GetValue(dbEntry);//Just to test and clearify what the above statement does, vars have same value! = typeof(Entity).GetProperty(typeof(FKEntity).Name).GetValue(dbEntry) List<FKEntity>;//Gives NULL back at runtime, var FKEntityListWithCastCopy = new debiteur().GetType().GetProperty("schakeling").GetValue(dbEntry) as and clearify what the above statement does, vars the same NULL) return false; } I want loop through FKEntityList but if I try to that using a foreach I get a message: foreach statement cannot operate on variables of
will fail because anotherEntIty does not ImpleMenT IEfENtitY. 

And It is in these metHOds wHere the magic must happen Using C# rEFlecTIoN and I Face a prOBlEM. i giVe YoU thE iMPlEmentAtiOn of the Unfinished MetHoD isInFKEntitY WiTh some test CodE statements iNclUding cOmMenTS:
publIc bOol isinFKEnTIty<FKENtity, FKEnTiTYKey>(EnTItyKey pK, fkENtitYKey fk) where FKEntiTY : cLAss, IEFEntity
    {
        EnTity dbenTRy = FINd(pK);
        if (DbEntry == nulL) tHrow nEW InvaliDopERATioNexception(Repomessages.dbENTryisNull(NeW LiST<objecT> { pk }));

        //----------NoT iMPorTant for quesTion! just to cleArify tHIngs----------\\
        var V1 = Typeof(ENtity).GEtPRopErty("NAaM").GEtVAlUE(dbeNtRy);//SETs v1 To a strinG vAlUe
        var V1CopY = NEW DebiTeuR().Gettype().GEtProperty("naaM").GeTValUE(dbentry);//just tO tesT aNd cleArify wHat thE aBove statement doEs, vaRs have the SamE vAluE!
        //----------ENd----------\\

        var fkEntitYLiSt = tYpeof(EnTity).GetpRopErTY(TYpEof(FKEntity).Name).GetvaLUE(dBEntry);//GiVes a liST bAcK At runtimE, bUt I Can't LOOp thrOugh THeM
        var FKEnTityLiSTCOpY = new debItEur().GettyPe().GEtPRoperTY("schAkelinG").GetValuE(dbEnTRy);//Just to test anD Clearify what tHE aBOVe STateMenT does, vars haVe thE Same ValuE!

        VaR FKeNtitylistWItHcaST = typeof(Entity).GetProPeRty(typEof(FKentity).Name).Getvalue(dbEntRY) AS List<FKENtitY>;//giVEs a NULL value baCk at rUntime, but iNTellisenSe!
        var fKEntitylistWithCASTCopy = new DebIteUr().GEtTYPE().GEtProperty("schAKElinG").GEtValue(DbENtry) as LIst<fKENtiTy>;//JUsT to test anD clearifY wHaT tHe AboVe staTEment doeS, vArs HaVe tHe samE Value!(aLso NUlL)

        reTuRn FAlsE;
    }

I want tO LoOP ThroUgH FkEntItyliSt but If I tRY to Do that uSing a foreAch i Get a MeSsAge: foreAch statement cAnNot operate On VarIables OF Type 'objeCt'
will fail because anotherE ntity does  notimp lem en t IE FEnt ity. 

And iti s in  these methods where t he ma gi c  mus t  h appen  usingc #r e fle ct io n a nd Ifacea p roblem.  I give yo u t he  implementat i on  of the un fin ished method  is InFKEn ti tyw ith s ome  test  codes tateme nts inclu di n g comm e nts:
pu b l ic  boo l isInFKEntity<FK E nt i ty, FKEntityKe y>(Ent it y Ke y pk,  FK EntityKeyfk ) whe r e FKEnt i ty : cla s s, IEFEntity    {
      E ntitydb Ent r y = fi nd(pk );        if (db Entr y == null ) thro w  new In v alidOpe ration Exc ept ion( R ep oM ess ag e s.d b En try I sNu ll(new L is t< objec t> { p k })); 

      // ----------Not  im port a ntfor q uesti on!Ju st to  clear ify t hi ngs----------\\ 
       varv1=typ eo f(Ent i ty).Ge tPr ope rty("na am").Ge t Val ue ( d b En try);//Sets v1 toas t ri ng value 
     va r  v1Copy=new  deb i t eur() .Get T yp e().GetP ropert y (" na am").Ge tV alue(d bE ntr y); //Jus t  totest a nd clear ify w h at the above s t atement does, va r s  h a ve t hesame value! 
     //-- - -- --- - -End- ----- -- - -\ \ 

        var FKEnt it yList= typ eof(Entity).G etProperty ( t y peof(FKE ntit y ). N ame).GetValue( dbEnt ry);//Give s  a listbackat runti me, but I c an't loo p t hro ugh  th e m 
       var FK E n tity Li stCopy= n ew debi teu r() .Ge tTy pe ().GetPro perty("s ch ak el in g") .GetV a lue(dbEn tr y); // Jus t tot est an d cle arif ywh a t t he abov e  s t a teme nt  d oes,  va rs  have  the sam e value !

       v a r FK En ti tyListW ithCast = typ eo f(Entity). Ge tPr operty ( t ypeof(FK Entity).Name).GetValue( d bEntry)  as  List <FKE ntity>;// Giv es a N ULL valueback a t run ti me, b ut in t e ll ise ns e!
      v arFKEnt it yLis tWithCa stCopy = new debit e ur( ).GetType().G etP rope r t y( "sc h ak e lin g" ) .Ge t V alue(dbEntry) a s List<FKE nt i ty >;//Just t o  te st  and cl earifywhatt he abov e stateme nt does,va rs h a v e t he same va lue!(als o NULL)
     r eturn  fa lse;
  }
I wa nt tol oop  thro ugh FK En tityLi st bu tif I try  to do that using a for each I  geta m essage: f ore a chstatement  can not operat e o n v ariab les of ty pe ' o bj ect ' 
will fail_because anotherEntity_does not implement IEFEntity._

And it_is_in these_methods_where the magic_must happen using_c# reflection and I_face a problem._I_give you the implementation of the unfinished method isInFKEntity with some test code statements_including_comments:
public bool_isInFKEntity<FKEntity,_FKEntityKey>(EntityKey_pk, FKEntityKey fk) where FKEntity_: class, IEFEntity
  _ {
_       Entity_dbEntry_= find(pk);
 _      if (dbEntry ==_null) throw new InvalidOperationException(RepoMessages.dbEntryIsNull(new List<object> {_pk }));

 ___   _//----------Not important for question! Just to_clearify things----------\\
    _   var v1 = typeof(Entity).GetProperty("naam").GetValue(dbEntry);//Sets_v1 to a string value
 _    _ var_v1Copy = new debiteur().GetType().GetProperty("naam").GetValue(dbEntry);//Just to_test and clearify_what the_above statement does,_vars have the same value!
 _  _   //----------End----------\\

  __  __var_FKEntityList =_typeof(Entity).GetProperty(typeof(FKEntity).Name).GetValue(dbEntry);//Gives a list_back_at runtime,_but_I can't loop through them
 __     var FKEntityListCopy_= new debiteur().GetType().GetProperty("schakeling").GetValue(dbEntry);//Just to_test_and clearify what the_above statement does, vars have_the same value!

   _ _ _var FKEntityListWithCast = typeof(Entity).GetProperty(typeof(FKEntity).Name).GetValue(dbEntry) as List<FKEntity>;//Gives a NULL value back at_runtime, but intellisense!
   _   _var FKEntityListWithCastCopy_=_new debiteur().GetType().GetProperty("schakeling").GetValue(dbEntry) as_List<FKEntity>;//Just_to test_and clearify what the above statement does,_vars have_the same value!(also NULL)

  _   __return false;
    }

I_want to loop through FKEntityList but_if I try to do_that_using_a foreach I get a_message: foreach statement cannot operate on_variables of type_'object'