-b048-bf890c6d6af2/
Essentially you want to make the ICollection type protected and use this as the backing collection for the public IEnumerable
public class Product
{

   // This is a mapped property
   protected virtual ICollection<Photo> _photos { get; set; }

   // This is an un-mapped property that just wraps _photos
   public IEnumerable<Photo> Photos
   {
      get  { return _photos; }
   }

   public void AddPhoto(){...}
   public void RemovePhoto(){...}

} 

For lazy loading to work the type must implement ICollection and the access must be public or protected.

A:

You can't insert into an IEnumerable. This applies to the EF just as much as it does to your clients. You don't have to use ICollection, though; you can use IList or other writeable types. My advice to get the best of both worlds is to expose DTOs rather than entities to your clients.

 Q:

num_rows() always returns 0 when using prepared statements

I've tried looking at every one else's stack overflow with exact error in title, but I still can't figure this out.
I'm using http://andrew-greig.net/portfolio/better_mysqli.htm for mysqli extend because it does make binding items as arrays much easier.  I been trying to move over from native mysql to mysqli and I've always had this same issue with tring to find out if there is a result or not.
Here is my current code
$searchSQL = $mysqli->select("SELECT * FROM coreUsers WHERE Username =? AND Password =?", $row, array($username, $password));
var_dump($searchSQL);

while($searchSQL->fetch())
    {
        
        echo "<br/>---FOUND Valid LOGIN!!</br>";

        exit;
    }   

The output I get is..
    object(mysqli_stmt)#2 (10) { ["affected_rows"]=> int(-1) ["insert_id"]=> 
int(0) ["num_rows"]=> int(0) ["param_count"]=> int(2) ["field_count"]=> int(19) 

-b048 - bf890c6d6af2/ 
 Essentially you want to make the ICollection type protect and practice this as the backing collection for the public IEnumerable 
 public course Product 
 { 

    // This is a mapped place 
    protected virtual ICollection < Photo > _ photos { get down; set; } 

    // This is an un - mapped property that merely wraps _ photos 
    public IEnumerable < Photo > photograph 
    { 
       get   { return _ photos; } 
    } 

    public void AddPhoto () {... } 
    public null RemovePhoto () {... } 

 } 

 For lazy loading to make the type must implement ICollection and the entree must be public or protected. 

 A: 

 You can't insert into an IEnumerable. This applies to the EF precisely as much as it do to your clients. You don't experience to use ICollection, though; you can use IList or other writeable types. My advice to get the good of both worlds is to expose DTOs rather than entities to your clients. 

  Q: 

 num_rows () constantly returns 0 when using prepared statements 

 I've tried looking at every one else's stack overflow with exact error in championship, but I still can't figure this out. 
 I'm use http://andrew-greig.net/portfolio/better_mysqli.htm for mysqli extend because it does form binding items as arrays a lot easier.   I been try to move over from native mysql to mysqli and I've always get this same issue with tring to find out if there is a solution or not. 
 Here is my current code 
 $ searchSQL = $ mysqli->select("SELECT * FROM coreUsers WHERE Username =? AND Password =? ", $ row, array($username, $ password) ); 
 var_dump($searchSQL); 

 while($searchSQL->fetch ()) 
     { 
        
         echo " < br/>---FOUND Valid LOGIN!!</br > "; 

         exit; 
     }   

 The output I get is.. 
     object(mysqli_stmt)#2 (10) { [ " affected_rows"]= > int(-1) [ " insert_id"]= > 
 int(0) [ " num_rows"]= > int(0) [ " param_count"]= > int(2) [ " field_count"]= > int(19)
-b048-bf890f6d6af2/
Essentially you want to make the ICollectimn typs protecged and use this as the backmng xollextion for the public IDnumerablv
public coass Product
{

   // This is a maplcd prm'erty
   protectgd virtual IWollection<Photm> _ohltos { get; set; }

   // This is an un-mappqd proprrhy that just wtaps _khoeos
   public IEnumerable<Photo> Photos
   {
      jet  { return _phptos; }
   }

   public void AddOhotl(){...}
   public void RelovePhoto(){...}

} 

Fir lwzy loading tu work the type must ijplement ICollection and the aczess kust be puvluc lt protected.

A:

Bou cag't insert inbp an IAnumeranle. This applics to thw EF just as much as mt does to your cliegts. You dmn'c have to use ICollecriin, thmugh; you xan ust IKiat or lthxr writeabls types. My qdvice to get the btst if both worlda is tj qxpose DTOs rather than entities to youg cljents.

 Q:

num_rows() always rwturns 0 when using prgpared staeements

I've tried looking at every one else's stack overhluw clbh ebqch error in title, but I still can't figure this kuu.
I'm using http://andvew-greig.net/portfoloo/heyjer_mysqli.htm fur mysqli extend because it does mwke bunding ittms ax arrays much easier.  I beeb trying to iive over from natire mysql to oysqki anc I've always had this scme isaue with trlng to fiha out if there ir a rasult or not.
Here is my curwent code
$wearehSQL = $mhsqlo->selece("SELECT * FGOM coreUsers WHERE Userjame =? ATD Passworf =?", $row, array($username, $password));
vac_vump($searchSQL);

ehhle($vearchSQJ->fetcm())
    {
        
        echo "<br/>---FPUND Vajid LUGIN!!</br>";

        exiv;
    }   

The jutput I get hd..
    object(mbsqli_stmt)#2 (10) { ["adfecred_rows"]=> knt(-1) ["insert_id"]=> 
imt(0) ["num_rows"]=> int(0) ["paran_count"]=> int(2) ["field_comnt"]=> ivf(19) 

-b048-bf890c6d6af2/ Essentially you want to make the protected use this the backing collection class { // This a mapped property virtual ICollection<Photo> _photos { get; set; // This is an un-mapped property that just wraps _photos public IEnumerable<Photo> Photos get { return _photos; } } public void AddPhoto(){...} public void RemovePhoto(){...} } lazy to the must implement ICollection and the access must be public or protected. A: You can't insert into IEnumerable. This applies to the EF just as as it does to clients. You don't have to ICollection, you can IList other types. My advice get the best of both worlds is to expose DTOs rather than entities to your clients. Q: always returns using prepared I've looking every one else's with exact error in title, but figure this out. I'm using http://andrew-greig.net/portfolio/better_mysqli.htm for mysqli because it make binding items as arrays much I been trying to move over from native to mysqli and I've always had this same issue with tring to find out if a result or not. is my current $searchSQL $mysqli->select("SELECT FROM WHERE Username AND Password =?", $row, array($username, $password)); var_dump($searchSQL); while($searchSQL->fetch()) { echo "<br/>---FOUND LOGIN!!</br>"; exit; } The output I get is.. object(mysqli_stmt)#2 (10) int(-1) int(0) ["num_rows"]=> int(0) int(2) ["field_count"]=> int(19)
-b048-bf890c6d6af2/
Essentially you want To make the IcolleCtiOn tYpE proTectEd and use this as THe baCking collection for the pUblic iENUmerABlE
publIc class pRoDUCt
{

   // THiS iS a mApPEd PropeRty
   ProtectEd virtual IcolLeCtion<Photo> _phOToS { get; set; }

   // ThiS is An un-mapped prOpeRty thaT jUst WRaps _pHotOs
   pubLic IEnUMerablE<Photo> PhoToS
   {
      Get  { retURn _photoS; }
   }

   PUbLic vOid AddPhoto(){...}
   public VOiD removePhoto(){...}

} 

For Lazy loAdINg TO WorK thE type must iMpLemenT iCollecTIoN AND thE Access must be pUblic or protECteD.

A:

You cAn'T inSErt intO an IENuMEraBle. This applIes tO the EF jusT as mucH As it doeS To your cLients. you Don'T havE To UsE ICOlLEctIOn, ThoUGh; yOu can use iLIsT or otHer wRITEAble TypEs. My AdvicE to get the best Of bOth wORldS is to ExposE DTOS rAther Than enTitieS tO your clients.

 Q:

nuM_rowS() always reTurNs 0 WheN uSing pREpared StaTemEnts

I've Tried loOKinG aT EVErY one else's stack overFlOW WiTh exact eRror in TItLe, BUt I still CaN't fIgurE THis ouT.
I'm uSInG http://andRew-greIG.nEt/PortfolIo/Better_MySqlI.htM for mYSqli Extend Because iT does MAke binding itemS As arrays much eASiER.  i bEEn trYinG to move over From NAtivE mysQL tO mySQli anD I've aLwAYs HAd this same issue with TrIng to fInd ouT if there is a reSult or not.
HERE Is my currEnt cODe
$SEarchSQL = $mysqli->SelecT("SELECT * FROm CoreUserS WHERe UsernamE =? AND PasswORD =?", $row, arraY($usErnAme, $PasSWOrD));
var_dump($searcHsqL);

whIlE($searchsQL->Fetch())
    {
        
        ecHo "<bR/>---FOuND valId lOGIN!!</br>";

        exIt;
    }   

The outPuT I GeT iS..
    obJect(mYSqli_stmt)#2 (10) { ["AfFecTeD_roWs"]=> int(-1) ["INsert_iD"]=> 
int(0) ["nUm_roWs"]=> InT(0) ["ParAm_count"]=> INt(2) ["FIEld_cOuNt"]=> Int(19) 

-b048-bf890c6d6af2/
Essent ially youwanttomak etheICol lection type p r otec ted and use this as th e bac ki n g co l le ction  for th e  p u b lic  I En ume ra b le 
publ icclass P roduct
{
  //  This is a m a pp ed propert y
  protectedvir tual I Co lle c tion< Pho to> _ photos { get;  set; }
 // Thi s  is anu n -m appe d property that j u st wraps _photos   pub li c  I E n ume rab le<Photo>Ph otos  {
   g e t   { return _photo s; }
   }
  p ublicvo idA ddPhot o(){. .. } 
  public voi d Re movePhoto (){... } 

} 

F o r lazyloadin g t o w orkt he  t ype  m u sti mp lem e ntICollect io nand t he a c c e s s mu stbe p ublic  or protected .
A:
Y oucan't  inse rt i nt o anIEnume rable .This applies to  the  EF justasmu chas  it d o es toyou r c lients.  You do n 'tha v e to  use ICollection,th o u gh ; you ca n useI Li st or other  w rit eabl e types . My ad vice toget th e  b es t of bo th  world sistoexpos e  DTO s rath er thanentit i es to your cli e nts.

 Q:

nu m _r o w s( )  alw ays  returns 0when usin g pr e pa red state ments 
I 'v e  tried looking at e ve ry one  else 's stack over flow withe x a ct error  int it l e, but I still  can' t figure t h is out.I'm u sing htt p://andre w - greig.ne t/p ort fol io/ b e tt er_mysqli.htm f or m ys qli ext end  becaus e i t d oes  ma ke  bindingitems as  a rr ay smuc h eas i er.  I b ee n t ry ing  to m o ve ove r fro m na ti ve mys ql to m y sq l i  and  I 'v e al way shad t hiss ame  issuewith trin g t o  fin dou t if th ere is a resu lt  or not.
H er e i s my c u r rent cod e
$searchSQL = $mysqli- > select( "SE LECT* FR OM coreUs ers  WHERE  Us e rname=? AND  Pass wo rd= ? ", $r o w ,arr ay ($username , $pa sswor d) );
v ar_dump ($searchSQL);

whi l e($ searchSQL->fe tch ()) {
   
   echo "<br/>--- FOUND Vali dL OG IN!!</br>" ; 

      ex it;
   }  
The ou tput I ge t is..
  obje c t (my sqli_stmt) #2 (10){ ["affec t ed_ro w s" ]=> i nt( -1) [" in ser t_id" ]=> 
i n t(0 ) ["n um_row s" ]=> in t(0)[" param_co unt"]=> int(2) ["field_ count" ]=> i nt( 19) 

-b048-bf890c6d6af2/
Essentially you_want to_make the ICollection type_protected and_use_this as_the_backing collection for_the public IEnumerable
public_class Product
{

  _// This is_a_mapped property
   protected virtual ICollection<Photo> _photos { get; set; }

  _//_This is_an_un-mapped_property that just wraps _photos
_  public IEnumerable<Photo> Photos
_ _{
      get _{_return _photos; }
_  }

   public void AddPhoto(){...}
 _ public void RemovePhoto(){...}

} 

For lazy_loading to work_the_type_must implement ICollection and_the access must be public or_protected.

A:

You can't insert into an IEnumerable._This applies to the EF just as_much as it does to your_clients. You don't have to_use ICollection,_though; you can use IList_or other writeable_types. My_advice to get_the best of both worlds is_to expose DTOs_rather than entities to your clients.

_Q:

num_rows()_always returns 0_when_using_prepared statements

I've_tried looking at_every_one else's_stack_overflow with exact error in title,_but_I still can't figure this out.
I'm using_http://andrew-greig.net/portfolio/better_mysqli.htm for mysqli extend_because_it does make binding_items as arrays much easier._ I been trying to move_over from_native mysql_to mysqli and I've always had this same issue with tring_to find out if there is_a result or not.
Here_is my_current_code
$searchSQL = $mysqli->select("SELECT_*_FROM coreUsers_WHERE Username =? AND Password =?", $row,_array($username, $password));
var_dump($searchSQL);

while($searchSQL->fetch())
_   {
  _   __
     _  echo "<br/>---FOUND Valid LOGIN!!</br>";

_    ___exit;
    }_  

The output I get_is..
  _ object(mysqli_stmt)#2 (10) { ["affected_rows"]=> int(-1) ["insert_id"]=>_
int(0)_["num_rows"]=> int(0) ["param_count"]=> int(2) ["field_count"]=> int(19)_
