Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

EntityFrameworkCore and get data of column which is not a KEY

$
0
0

how can i get a row from sql server where the row that i want to fetch

is not part of the key?

for example

public class Accounts
    {
        [Key]
        public int AccountID { get; set; }
        public string CompanyName { get; set; }
        public string Address { get; set; }
        public string Telephone { get; set; }
        public string ContactName { get; set; }
        public string CellPhone { get; set; }
        public string City { get; set; }
        public int? ZipCode { get; set; }
        public string Country { get; set; }
}

and i want to search it by CompanyName -how to di it?

because using

entities.AsQueryable()

and then filter it seam's a waste of resource and performance.


Viewing all articles
Browse latest Browse all 9386

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>