mvvm - getting started with an asp.net webforms UI for c# application which uses nHibernate -


hi
i've been building backend of application (using nhibernate data access).
far i've had simple web-services manipulating data, i'm required develop web ui on application (using web forms).

i've been looking @ different web frameworks (webformsmvp, spring.net web), , @ client-side js frameworks (knockout, angular), , can't decide best me, , how integrate all.
hoping insight guys.

i think general workflow this:

  1. view created, calls presenter.
  2. presenter contacts business layer retrieve information (which in turn contacts dao etc.)
  3. presenter returns view-model object, view displays.
  4. user manipulates data (maybe using ajax retrieve further needed information)
  5. view sends view-model of manipulated data presenter
  6. presenter translates view-model model entity , sends business layer

    here parts find tricky:

a. how map between view-model , model entities
think should use entitie's id retrieve unchanged entity dao (which stores in nhibernate's 2nd level cache), , perform changes on it.
(another option store entity i'm editing in user's session. i'm afraid kind of caching create duplicity nhibernate's cache.)

b. how translate changes on view-model changes on model entities
i'd have logic when changing model entity's properties.
example, moving employee 1 department another, don't want allow this-

department1.employees.remove(employee); department2.employees.add(employee); 

but rather this:

employee.movetodepartment(department2); 

i'm afraid complicated when translating view-model model.

any thoughts on above 2 questions, , client-side / server side frameworks appriciated.

p.s. quick background on app:
-one page of web app displays company's structure (departments, divisions etc.) tree, , allows user click , edit different nodes, drag-and-drop nodes change location.

-another page displays current stock status (for each warehouse- how many products has, how many machines operative in warehouse etc.)

- (some more pages display data , allow editing...)

thanks
jhonny

you can check out automapper entity mapping. alternatively can write own entity mappers , entity updaters. can encapsulate business logic move department in entity classes.

your approach sounds fine, , can recommend webforms.mvp framework writing testable webforms apps without rolling own implementation.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

sql server - python to mssql encoding problem -

windows - Python Service Installation - "Could not find PythonClass entry" -