Is there a way to tell AutoMapper to ignore all of the properties except the ones which are mapped explicitly?
I have external DTO classes which are likely to change from the outside and I want to avoid specifying each property to be ignored explicitly, since adding new properties will break the functionality (cause exceptions) when tr...
I've been reading up on AutoMapper because of a response to one of my earlier questions here. It says that AutoMapper flattens complex domain models, but I need something that does the opposite. I need to wire up my view models (flattened domain models) to the complex domain models so that I can quickly transform a view model into a doma...
Jimmy Bogart has an article on using Automapper with an IoC container. He has an example using StructureMap but I am using Unity and I'm not sure how to use an InjectionConstructor properly.
Below is the code from the Article and below that is my poor attempt. Can anyone tell me how to do this properly?
public class ConfigurationRegis...
I am using AutoMapper + EF (Entities => POCO) for the following class:
public class Category
{
public int CategoryID { get; set; }
public string Name { get; set; }
public Category Parent { get; set; }
public IList<Category> Children { get; set; }
}
Since this class has relationship with itself (Parent / Children), A...
I am using Entity Framework + AutoMapper to convert the EntityObjects to POCO.
The relationships in EF use EntityCollection<T>. The relationships in POCO use ICollection<T>. Since EntityCollection<T> : ICollection<T>, i thought it would be super easy to cast.
However, when AutoMapper tries to cast the EF EntityCollection<T> to POCO, it...
I have this test in my test base:
public void WorksWithAreaUsers()
{
using (new TransactionScope())
{
//arrange
var userBusiness = new UserBusiness();
var user = new User
{
Name = "TestUser###",
Login = "domain\test-user###"
};
userBusiness.Add(user);
var...
I have a site where I'm using fluentNhibernate and Asp.net MVC. I have an Edit view that allows user to edit 8 of the 10 properties for that record (object). When you submit the form and the Model binds, the two un-editable fields come back in the view-model as Empty strings or as default DateTime values depending on the type of proper...
Hi
I struggle with AutoMapper and a list of wrappers. I have an client/server solution where on the server side the object looks like this.
public class Trainer{
public List<Team> Teams{get;set;}
...
}
public Class Team{...}
On the Client side I have my own Collection, TSCollection and the classes looks like this.
public clas...
Hi there,
I have been using automapper pretty successfully lately but i have come across a small problem for mapping the Dest to a variable not a available in the Src.... An example explains it better.. basically i am mapping from dest to src as per instructions .. all working well but i need to now map a destination to a variable named...
I am new to NHibernate and am running into some issues getting the Automap functionality to work properly. Here are a couple of issues I am having.
The getting started wiki for Fluent NHibernate (http://wiki.fluentnhibernate.org/Getting_started) defines a sample with store, product, and employee classes--as well as the mapping for thos...
I am using Fluent-NHibernate (with automapping) to generate my tables but would like to choose a different clustered index than the ID field which is used by default. How can you create clustered indexes with Fluent NHibernate on a field other than the default Primary Key field?
The primary reasoning behind this is simple. I am using Gu...
I am attempting to use the Fluent-NHibernate automapping functionality (in the latest version of the software) and am running into problems using Guids as the Primary Key fields. If I use integer fields for the primary keys, the tables are generated successfully and all Nhibernate functionality seems to work fine. FYI, I am using NHibern...
if object a has a property name 'Id' and object b has a property name 'ID' will AutoMapper correctly map the 2 properties (without doing a .ForMember(...) call)?
...
I am trying out Automapper as well as otis.
I have a source type that is something list this (only partial code shown here):
class Source
{
ReadOnlyDictionary<string, customtype> items;
}
My DTO is like so:
class ClassDTO
{
IList<string> pageNames;
}
Now how do I map the pagenames in my DTO to "items" in the source type, ...
I'm mapping my Linq-To-SQL generated entities to DTOs using AutoMapper.
When I initially created the unit tests, I had specific maps (through a static configuration class) set up to convert one type of EntitySet to a generic List (and vice-versa)
Mapper.CreateMap<EntitySet<Member>, List<MemberDTO>>();
Mapper.CreateMap<List<MemberDTO>...
My current project with assemblies for the domain model, MVC web application, and unit tests. How can I set up the AutoMapper configuration so that all assemblies reference the same configuration?
I would guess that I could put items in Global.asax for the web app, but how can I use that in the unit tests? Also, if the config is in Glo...
With the following mapping:
Mapper.CreateMap<ObjectA, ObjectB>()
.ForMember(dest => dest.SomeStringProperty, opt => opt.MapFrom(src => null))
SomeStringProperty is now empty string not null (as I would expect)
Is this a bug? How can I get it to actually be null?
I see that opt.Ignore() will make it null but I actually want to do...
I have a BLL class which contains properties for the fields in a Country table (CountryCode, CountryName, etc). It also has a property ioDAL, which is a reference to a DAL class (created with SubSonic 2.2), which has same named fields.
I have a LoadRecord() method which calls the DAL's FetchById() method that populates the DAL properti...
I'm updating or creating an entity that has a child relationship, say the aggregate root is Product (ProductId, Title) which has zero or more ProductSuppliers (ProductSupplierId, SuppliedAtPrice, SupplierInfoId), and the DTO represents a similar structure (all the info). Simple enough.
I've created a simple map for ProductDTO and Produc...
Many people have written about using Automapper to map domain objects (models) to view models, which I find very interesting and useful, but my question is about how to do the opposite. I understand the complexity of this process and why Automapper doesn't work in that scenario but I have to do that a lot with form posting, specially whe...