c# - Entity Framework Virtual ICollection How to Query -
After the
First of all, I'm new to trying out the outline of the unit and trying to find some things. I have a model like this:
Public class EventInstance {[column ("EVENT_INSTANCE_ID")] Public Integer EventInstanceID {Get; Set; } [Column ("CUSTOMER_ID")] Get Public Inter Customer ID { Set; } [Column ("EVCIDID")] Public Event Event Id {Received; Set; } [Columns ("START_DATE_TIME")] Public System Datetime start date {received; Set; } Received Public Virtual Event Event { Set; }}
I need to use a property in the table named EventTimeEventInstances but this table is not included in the model. I have two questions.
If I add:
public virtual icon & lt; Event Time Event Instance & gt; Event TimeInstance {Received; Set; }
Will that effect affect other areas of our application
Secondly, how do I use the property from ICollection in such a question:
< Previous> Public IQueryable & lt; EventInstance & gt; GetInstances (Int ScheduleID) {// Installation date time returned only 3 months ago date range = date time.Now Adidies (-180); Return EventDBContext.EventInstances.Where (x => x.CustomerID == MultiTenantID & amp; x.StartDateTime & gt; = DATERANGE) .OrderBy (X => x.StartDateTime) .AsQueryable (); }
I should be able to add EventTimeInstances.EventTimeID == scheudleID to this query. How can I do this
You can use it as in your query:
Public IQueryable & lt; EventInstance & gt; GetInstances (Int ScheduleID) {// Installation date time returned only 3 months ago date range = date time.Now Adidies (-180); Return EventDBContext.EventInstances.Where (x = & gt; x.CustomerID == MultiTenantID & amp; x.StartDateTime & gt; = DATERANGE & amp; x.EventTimeInstances.Any (a => A .EventTimeID == scheudleID)). Orderbie (x = & gt; x. Startdate). Enkennable (); }
Comments
Post a Comment