क्लास नामों के लिए डेटाबेस फ़ील्ड नामों को मैप करने के कई तरीके हैं, लेकिन अंडरस्कोर को हटाने का सबसे आसान तरीका क्या है?मानचित्रण करते समय फ़ील्ड नामों में अंडरस्कोर को अनदेखा/निकालने के लिए डैपर कैसे प्राप्त करें?
public IEnumerable<PersonResult> GetPerson(int personId)
{
using (var dbConnection = _dbConnectionFactory.Create(ConnectionStrings.ProjectXYZ))
{
IEnumerable<PersonResult> result =
dbConnection.Query<PersonResult>("fn_get_person", new { personId },
commandType: CommandType.StoredProcedure).ToList();
return result;
}
}
तालिका और डेटाबेस फ़ील्ड:
person
--------
person_id
full_name
क्लास कि काम करता है: (व्यवसायिक पहले से ही ध्यान नहीं देता पूंजीकरण)
public class PersonResult
{
public int Person_Id { get; set; }
public string Full_Name { get; set; }
}
मैं करने के लिए वर्ग परिवर्तन करना चाहते हैं क्या:
public class PersonResult
{
public int PersonId { get; set; }
public string FullName { get; set; }
}
क्या आप PostgreSQL और नहीं एसक्यूएल सर्वर का उपयोग कर रहे हैं? – Andomar
हां। :) अनुमान लगा रहे हैं कि आप पूछ रहे हैं क्योंकि कमांड प्रकार "संग्रहीत प्रक्रिया" है और postgresql में केवल फ़ंक्शन हैं? यह अभी भी काम करता है। – scw