Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6319333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:47:21+00:00 2026-05-24T15:47:21+00:00

I have a customer class & I’d like to have the customer emails field

  • 0

I have a customer class & I’d like to have the customer emails field display in CSV format for an admin list view. When the edit view shows, I’d like to have the view show emails in a textbox split with a newline character feed.

I don’t want to have 2 different classes for each view just use the same, with the first using IEnumerable<T> to display the list. My class is quite large and I don’t want to have 2 separate view classes to manage.

The ideal goal would be to have 2 different AutoMapper mappings 1 for each different mapping scenario rather than just being limited to the the one created using CreateMap at bootstrap stage. How do I achieve this? Effectively I’d like to switch the mapping strategy depending on where I am in the code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T15:47:22+00:00Added an answer on May 24, 2026 at 3:47 pm

    Ideally you would use two different View Models and map the source to the desired destination. However, if you don’t want to go this route one option would be to create a view model that has two readonly properties.

    public class SomeClassViewModel
    {
        public string FirstName { get; set;}
    
        public string LastName { get; set; }
    
        public string Emails { get; set; }
    
        public string EmailsCSV
        {
            get
            {
                var csv = Emails;
                //Do CSV transform here
                return csv;
            }
        }
    
        public string EmailsCRLF
        {
            get
            {
                var crlf = Emails;
                //Do crlf transform here
                return crlf;
            }
        }
    
    }
    

    Again, ideally you would want to stick with the rule of one model per view. That doesn’t mean you are required to write an entirely new view for each model, there’s always inheritance.

    MyViewModelA : MyViewModelBase
    MyViewModelB : MyViewModelBase
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Customer class which has a representative field....this field is initially blank
I have a Customer class. public class Customer { private string _id; private string
I have a Customer class that contains a property, MyProperty, which is of a
In my application I have a Customer class and an Address class. The Customer
Say I have a class Customer which has a property FirstName . Then I
Suppose I have a class Customer that is mapped to the database and everything
Well, I have a class Customer (no base class). I need to cast from
I have a class with following description: public class Customer { public ISet<Client> Contacts
If I have the following domain object: public class Customer { public virtual Guid
Suppose I have the following types of data: class Customer { String id; //

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.