I am writing an ASP.NET MVC 2 application using NHibernate and repository pattern. I have an assembly that contains my model (business entities), moreover in my web project I want to use flattened objects (possibly with additional properties/logic) as ViewModels.
These VMs contain UI-specific metadata (eg. DisplayAttribute used by Html.L...
Hi Guys,
I'm using the S#arp architecture, and I can't remember where I read it, but they say they ViewModels should be stored at the service layer, and your views should submit the viewmodel to the service for processing.
My question then is this. Which layer should construct the ViewModel? Should it be at the service layer, and the ...
Hi,
i have a question regarding some complex data-binding.
I want to be able to update a grid (which has the property "IsItemsHost" set to true)
dynamically whenever a data-binding occurs.
Actually i am using a CustomControl which is an ItemsControl and this
has the Grid in its ControlTemplate.
To be more specific, i bind the grid to ...
Hello,
I have a list of CustomerViewModels in a ComboBox. The selected CustomerViewModel I want to delete and also the Customer wrapped inside it to remove it from the repository.
But how can I access the Customer model inside the CustomerViewModel?
...
As I familiarize myself with Asp.Net MVC, I am using MVC 2, I have noticed the use of a BaseViewData class in the Kigg project which I am unsure how to implement.
I want each of my ViewModels to have certain values available. Using an iterface comes to mind but I am wondering what the best practice is and how does Kigg do it?
Kigg
pub...
I have recently started using custom ViewModels (For example, CustomerViewModel)
public class CustomerViewModel
{
public IList<Customer> Customers{ get; set; }
public int ProductId{ get; set; }
public CustomerViewModel(IList<Customer> customers, int productId)
{
this.Customers= customers;
this.Product...
Hello,
I have a UserControl with 5 small UserControl which are parts of the first UserControl.
The first UserControl is datatemplated by a MainViewModel type.
The other 5 small UserControls have also set the DataContext to this MainViewModel type.
Now I want additionally that those 5 UserControls get a 2nd DataContext to access other...
The name "view model" suggests that it models the data for the view. That much is obvious. What else can or should go in the view model?
As an example, a view might display a list of items in a shopping cart, fields for customer's credit card info, and fields for customer's billing information. The view model might contain properties f...
I have a controller that takes in a viewmodel and submitbutton
public ActionResult AddLocation(AddLocationViewModel viewModel, string submitButton)
My view is bound to the viewmodel. The viewmodel contains a list objects used to create an html table with checkboxes. Is there a way to access the selected "rows" through the viewmodel in ...
I am using Prism for a new application that I am creating. There are several lookup lists that will be used in several places in the application. Therefore it makes sense to define it once and use that everywhere I need that functionality. My current solution is to use typed data templates to render the controls inside a content control....
So how do you display complex aggregated ViewModels whose Models have relations to each other?
NO wpf disciple ever spoke about that, guess why its not possible...
Do you think thats true?
Don`t understand me?
Look: A CustomerViewModel has many OrderViewModel and those many ProductViewModel.
You have 3 Workspaces to enter the new d...
Hi, I am trying to learn Domain Driven Design and recently read that lots of people advocate creating a ViewModels for your views that store all the values you want to display in a given view.
My question is how should I do the form validation? should I create separate validation classes for each view, or group them together? I'm also c...
In my html, I use Model.Subcontract.company
How can I reference that data in my jQuery?
...
I'm designing a larger enterprise architecture and I'm in a doubt about how to separate the models and design those.
There are several points I'd like suggestions for:
- models to define
- way to define models
Currently my idea is to define:
Core (domain) model
Repositories to
get data to that domain model from a
database or other sto...
So I think I'm doing something pretty basic. I know why this doesn't work, but it seems like there should be a straight foward way to make it work.
code:
private string fooImageRoot;
// ....
public BitmapImage FooImage
{
get
{
URI imageURI = new URI(Path.Combine(fooImageRoot, CurrentFooTypes.FooObject.FooImageName));
retu...
Hello,
everyone speaks about wrapping a model by a viewmodel. fine so far.
But when I want persist my Model, how do I convert a ViewModel into a Model ?
Reading all properties from the ViewModel into a new Model object seems very cumbersome.
Any better method?
...
I'd like to be able to map a domain model to a view model by newing up a view model and passing in the contributing domain model as a parameter (like the code below). My motivation is to keep from re-using mapping code AND to provide a simple way to map (not using automapper yet). A friend says the view model should not know anything abo...
Hi all, i'd like to know, I have a application in asp.net mvc and nhibernate. I've read about that in the Views on asp.net mvc, shouldn't know about the Domain, and it need use a DTO object. So, I'm trying to do this, I found the AutoMapper component and I don't know the correct way to do my DTOS, for some domain objects. I have a domain...
I have aggregated models like Customer:Order:Product.
As my View is bound to the BillingViewModel which has a Property Customers of type ObservableCollection
and ONE customer in this collection has a "list" of orders
named ObservableCollection
and ONE order in this collection has a "list" of products
named ObservableCollection
Well ...
Hello,
I have a Customer with Orders and those have products. Everything aggregated with collections of type ObservableCollection.
All 3 collections are bound to a datagrid/combobox.
I can only make the root collection (ObservableCollection Customers{ get;set;} )
passing to a CollectionView so I can move the current customer within t...