-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property 'Street' is not defined for type 'System.String' then sorting #6478
Comments
@dvdobrovolskiy what's the definition of Can you post your entities definitions and configuration s here so that others can reproduce it? |
Nothing criminal IMHO public partial class Apartment
{
public Apartment() : base()
{
}
[Key]
public int ApartmentId { get; set; }
[Required(ErrorMessage = "Укажите номер квартиры")]
[Display(Name = "Номер")]
public string Number { get; set; }
[Display(Name = "Этаж")]
public string Floor { get; set; }
[Display(Name = "Подъезд")]
public string Entrance { get; set; }
public int BlockId { get; set; }
public Block Block { get; set; }
[Display(Name = "Основной телефон")]
public string MainPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string SecondaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string TertiaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string QuaternaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string QuinaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string SenaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string SeptenaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string OctonaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string NonaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string DenaryPhone { get; set; }
}
public partial class Block
{
public Block() : base()
{
}
[Key]
[ScaffoldColumn(false)]
public int BlockId { get; set; }
[Display(Name = "Обслуживается")]
public bool IsInService { get; set; }
[Display(Name = "Регион")]
public string Region { get; set; }
[Display(Name = "Район")]
public string Rayon { get; set; }
[Display(Name = "Город")]
public string Town { get; set; }
[Display(Name = "Населенный пункт")]
public string InhabitatLocation { get; set; }
[Required(ErrorMessage = "Укажите улицу")]
[Display(Name = "Улица")]
public string Street { get; set; }
[Required(ErrorMessage = "Укажите номер дома")]
[Display(Name = "Номер дома")]
public string HouseNumber { get; set; }
[Display(Name = "Корпус")]
public string Korpus { get; set; }
[Display(Name = "Строение")]
public string Stroenie { get; set; }
[Display(Name = "Псевдоним")]
public string Alias { get; set; }
[Display(Name = "Этажность")]
public int? Stages { get; set; }
[Display(Name = "Подъездов")]
public int? Entrances { get; set; }
[Display(Name = "Площадь")]
public double? Square { get; set; }
[Display(Name = "Количество квартир")]
public int? NumberOfApartments { get; set; }
[Required(ErrorMessage = "Укажите дату начала обслуживания")]
[Display(Name = "Начало обслуживание")]
[DataType(DataType.Date)]
public DateTime? StartService { get; set; }
[Display(Name = "Окончание обслуживания")]
[DataType(DataType.Date)]
public DateTime? EndService { get; set; }
[Display(Name = "Квартиры")]
public List<Apartment> Apartments { get; set; }
[Display(Name = "Обслуживающая компания")]
public int CompanyId { get; set; }
public Company Company { get; set; }
[Display(Name = "Ответственный")]
[Required(ErrorMessage = "Укажите ответственного")]
public int UserId { get; set; }
public User User { get; set; }
}
public class ContactsVM
{
[Key]
[ScaffoldColumn(false)]
public int ApartmentId { get; set; }
[Display(Name = "Номер")]
public string Number { get; set; }
[Display(Name = "Этаж")]
public string Floor { get; set; }
[Display(Name = "Подъезд")]
public string Entrance { get; set; }
[Display(Name = "Адрес")]
public string Address { get; set; }
[Display(Name = "Основной телефон")]
public string MainPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string SecondaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string TertiaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string QuaternaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string QuinaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string SenaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string SeptenaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string OctonaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string NonaryPhone { get; set; }
[Display(Name = "Дополнительный телефон")]
public string DenaryPhone { get; set; }
} |
I made sample application to reproduce error |
You may use But there seems to be a problem with the generated query underline:
The |
MS SQL provider have same issue |
It is pretty annoying issue. I cannot order and query if it is a little complicated.
gives me
Works fine without orderby subquery |
This is a bug in our Failing query: AssertQuery<Order, Customer>((os, cs) =>
os.Select(o => new
{
OrderId = o.OrderID,
City = cs.SingleOrDefault(c => c.CustomerID == o.CustomerID).City
})
.OrderBy(o => o.City)); |
hmm |
@dvdobrovolskiy - You can call |
No good to me as I use sorting list after this has no point. |
If you are on Windows, you can use EF6 with ASP.NET Core 😄 |
True. Didn`t think about that. tnks! |
I have an issue then I try to sort by field from subquery
here is code
and I get
ArgumentException: Property 'System.String Street' is not defined for type 'System.String'
The text was updated successfully, but these errors were encountered: