Note that there are some explanatory texts on larger screens.

plurals
  1. PO Unable to create a constant value of type. Only use primitive types
    primarykey
    data
    text
    <p>I've read some other posts but they have not helped.</p> <p>CarPart is an EF4 gened class</p> <pre><code>[EdmEntityTypeAttribute(NamespaceName="xxxx.Data.Domain.Model", Name="CarPart")] [Serializable()] [DataContractAttribute(IsReference=true)] public partial class CarPart : EntityObject { #region Factory Method /// summary&gt; /// Create a new CarPart object. /// &lt;/summary&gt; /// &lt;param name="carPartId"&gt;Initial value of the CarPartId property.&lt;/param&gt; /// &lt;param name="name"&gt;Initial value of the Name property.&lt;/param&gt; /// &lt;param name="carPartTypeId"&gt;Initial value of the CarPartId property.&lt;/param&gt; public static CarPart CreateCarPart(global::System.Int32 carPartId, global::System.String name, global::System.Int32 carPartId) { CarPart carPart = new CarPart(); carPart.CarPartId = carPartId; carPart.Name = name; carPart.CarPartTypeId = carPartTypeId; return carPart; } #endregion #region Primitive Properties /// &lt;summary&gt; /// No Metadata Documentation available. /// &lt;/summary&gt; [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 CarPartId { get { return _CarPartId; } set { if (_CarPartId != value) { OnCarPartIdChanging(value); ReportPropertyChanging("CarPartId"); _CarPartId = StructuralObject.SetValidValue(value); ReportPropertyChanged("CarPartIdId"); OnCarPartIdChanged(); } } } private global::System.Int32 _CarPartId; partial void OnCarPartIdChanging(global::System.Int32 value); partial void OnCarPartIdChanged(); /// &lt;summary&gt; /// No Metadata Documentation available. /// &lt;/summary&gt; [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.String Name { get { return _Name; } set { OnNameChanging(value); ReportPropertyChanging("Name"); _Name = StructuralObject.SetValidValue(value, false); ReportPropertyChanged("Name"); OnNameChanged(); } } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); /// &lt;summary&gt; /// No Metadata Documentation available. /// &lt;/summary&gt; [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 CarPartTypeId { get { return _CarPartTypeId; } set { OnCarPartTypeIdChanging(value); ReportPropertyChanging("CarPartTypeId"); _CarPartTypeId = StructuralObject.SetValidValue(value); ReportPropertyChanged("CarPartTypeId"); OnCarPartTypeIdChanged(); } } private global::System.Int32 _CarPartTypeId; partial void OnCarPartTypeIdChanging(global::System.Int32 value); partial void OnCarPartTypeIdChanged(); #endregion #region Navigation Properties /// &lt;summary&gt; /// No Metadata Documentation available. /// &lt;/summary&gt; [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("xxxx.Data.Domain.Model", "FK_CarPartId", "Part")] public EntityCollection&lt;Part&gt; Parts { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection&lt;Part&gt;("xxxxx.Data.Domain.Model.FK_CarPartId", "Part"); } set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection&lt;Part&gt;("xxxx.Data.Domain.Model.FK_CarPartId", "Part", value); } } } /// &lt;summary&gt; /// No Metadata Documentation available. /// &lt;/summary&gt; [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("xxxxx.Data.Domain.Model", "FK_CarPartTypeId", "CarPartType")] public CarPartType CarPartType { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference&lt;CarPartType&gt;("xxxx.Data.Domain.Model.FK_CarPartTypeId", "CarPartType").Value; } set { ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference&lt;CarPartType&gt;("xxxxx.Data.Domain.Model.FK_CarPartTypeId", "CarPartType").Value = value; } } /// &lt;summary&gt; /// No Metadata Documentation available. /// &lt;/summary&gt; [BrowsableAttribute(false)] [DataMemberAttribute()] public EntityReference&lt;CarPartType&gt; CarPartTypeReference { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference&lt;CarPartType&gt;("xxxx.Data.Domain.Model.FK_CarPartTypeId", "CarPartType"); } set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference&lt;CarPartType&gt;("xxxxxx.Data.Domain.Model.FK_CarPartTypeId", "CarPartType", value); } } } #endregion } </code></pre> <p>So here's my join code:</p> <pre><code>List&lt;Parts&gt; parts = _context.Parts.Where(p =&gt; p.PartId == partId).ToList(); List&lt;CarParts&gt; parts = _context.CarParts .Join(parts, cp =&gt; cp.PartId, p =&gt; p.PartId, (cp, p) =&gt; cp).ToList(); </code></pre> <blockquote> <p>Error: Unable to create a constant value of type 'Model.CarParts'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.</p> </blockquote> <p>Tried to look at it but can't get past this. I'm a bit new to LINQ-To-SQL..done a fair amount but not a ton (mostly done LINQ to Objects) so new to joins with this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload