I can not update a record with fluent nhibernate 3 and map with generatedby.assigned generator -


i have design fluent n hibernate, use nhibernate linq query database. app use domain driver architecture. database mssql 2012. don't have problem insert, update or delete table except case of 1 table use id without seed identity. need use in map following:

 public class syschoollogomap : classmap<syschoollogo>     {         public syschoollogomap()         {             readonly();              table("syschoollogo");              id(x => x.id).column("imgid").generatedby.assigned();             map(x => x.contenttype).column("contenttype").nullable();             map(x => x.imagenbytes).column("image").not.nullable().length(50000);             map(x => x.imglenth).column("imglen").nullable();             map(x => x.imagefile).column("imgfile").nullable();             map(x => x.officialuse).column("officialuse").nullable();             map(x => x.imagecode).column("imagecode").nullable();             map(x => x.description).column("description").nullable();         } } 

the domain following:

 public class syschoollogo : domainentitywithtypedid<int> {   ... abbreviate } 

the base domainentitywithtypedid has id integer used table primary key.

the update operation using nhibernate link, i sure service called , executed.

the update service following:

[httppost]         public httpresponsemessage updatelogo([frombody]schoollogooutputmodel logodata)         {             try             {                 var logo = repository.get<syschoollogo>(logodata.id);                 if (logo == null)                 {                     throw new httpbadrequestresponseexception("the image not exists or erased in server.");                 }                logo.updatelogo(logodata.description, logodata.imagecode, logodata.officialuse);                  repository.saveandflush(logo);                  return new httpresponsemessage(httpstatuscode.ok);             } //catch ignored abbreviate. 

i had debugged procedure , sure operation of save executed, tried update, merge , flush variant. operation return ok, database not updated. missing something, can not find is, help?

well, using 5.1.3. class mapping:

<class     ...     mutable="true|false"                          (4)     ... 

(4) mutable (optional, defaults true): specifies instances of class (not) mutable.

which above mapping in fluent:

public syschoollogomap() {     readonly(); // mutable="false" 

and reason why nhiberante correctly not execute update...


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -