﻿
{"id":5594,"date":"2017-02-11T14:08:58","date_gmt":"2017-02-11T14:08:58","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=5594"},"modified":"2017-02-11T14:08:58","modified_gmt":"2017-02-11T14:08:58","slug":"entity-frameworkte-unable-to-create-a-constant-value-of-type-xxx-only-primitive-types-or-enumeration-types-are-supported-in-this-context-hatasi-ve-cozumu","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/entity-frameworkte-unable-to-create-a-constant-value-of-type-xxx-only-primitive-types-or-enumeration-types-are-supported-in-this-context-hatasi-ve-cozumu\/","title":{"rendered":"Entity Framework&#8217;te Unable To Create A Constant Value Of Type &#8216;xxx&#8217;. Only Primitive Types Or Enumeration Types Are Supported In This Context Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>Ge\u00e7enlerde \u00fczerine \u00e7al\u0131\u015ft\u0131\u011f\u0131m bir projede alm\u0131\u015f oldu\u011fum bir hata \u00fczerine konu\u015fuyor olaca\u011f\u0131z. Bu hatan\u0131n di\u011ferlerinden fark\u0131 belli ba\u015fl\u0131, tespit edilebilir durumlarda kar\u015f\u0131la\u015fabilmemizden ziyade; birden fazla sergilenen yakla\u015f\u0131mda kar\u015f\u0131la\u015f\u0131labilen ve geni\u015f yelpazeli bir olas\u0131 hata olmas\u0131d\u0131r.<\/p>\n<p>\u0130nceleyece\u011fimiz hata makalemizin ba\u015fl\u0131\u011f\u0131nda oldu\u011fu gibi<\/p>\n<blockquote><p><em><strong><span style=\"color: #003300;\">Entity Framework&#8217;te Unable To Create A Constant Value Of Type &#8216;xxx&#8217;. Only Primitive Types Or Enumeration Types Are Supported In This Context<\/span><\/strong><\/em><\/p><\/blockquote>\n<p>hatas\u0131d\u0131r.<\/p>\n<p>Bu hata; Entity Framework, LINQ vs. gibi Framework yap\u0131lar\u0131nda genellikle tan\u0131mlanmayan veri t\u00fcrleri \u00fczerinde al\u0131nan bir hatad\u0131r. Zaten hatada da bahsedilen yap\u0131lan \u00e7al\u0131\u015fma(art\u0131k ne ise)da \u00fczerinde \u00e7al\u0131\u015f\u0131lan veri t\u00fcr\u00fcn\u00fcn bilinen t\u00fcrlerden yahut numaraland\u0131r\u0131c\u0131lardan olmas\u0131 gerekiyor.<\/p>\n<p>\u015eimdi bizler bir ka\u00e7 \u00f6rnek durumu ele alarak ilgili hata durumunu g\u00f6zlemleyecek ve ard\u0131ndan \u00e7\u00f6z\u00fcmler \u00fczerine isti\u015fare ederek bir sonuca varaca\u011f\u0131z.<\/p>\n<p>\u00d6ncelikle verece\u011fimiz \u00f6rneklendirmelerde Entity Framework \u00fczerinden \u00e7al\u0131\u015fmalar\u0131m\u0131z\u0131 icra edece\u011fimizi \u015fimdiden bildiririm.<\/p>\n<p>\u0130lk ba\u015fta a\u015fa\u011f\u0131daki \u00f6rne\u011fi inceleyelim.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n            NorthwindEntities vt = new NorthwindEntities();\r\n            Personeller p = new Personeller { Adi = &quot;Nancy&quot;, SoyAdi = &quot;Davaleo&quot; };\r\n            vt.Set&lt;Personeller&gt;().Contains(p);\r\n<\/pre>\n<p>Dikkat ederseniz &#8220;Set&lt;Personeller&gt;()&#8221; metodundan d\u00f6nen sonu\u00e7 \u00fczerinden &#8220;Contains&#8221; metodu ile veri e\u015fle\u015ftirme sonucu sorgulanmaktad\u0131r. Bu komutlar\u0131 derleyip \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131m\u0131z zaman a\u015fa\u011f\u0131daki sonu\u00e7la kar\u015f\u0131la\u015fmaktay\u0131z.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5597\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc.png\" alt=\"Entity Framework'te Unable To Create A Constant Value Of Type 'xxx'. Only Primitive Types Or Enumeration Types Are Supported In This Context Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc\" width=\"863\" height=\"177\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc.png 863w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-300x62.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-768x158.png 768w\" sizes=\"auto, (max-width: 863px) 100vw, 863px\" \/><\/a><\/p>\n<p>G\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere &#8220;Set&lt;Personeller&gt;()&#8221; metodunun tipi &#8220;System.Data.Entity.DbSet&lt;Personeller&gt;&#8221;dir. Buradaki \u00e7al\u0131\u015fmada &#8220;Set&lt;Personeller&gt;()&#8221; metodu neticesinde d\u00f6nen sonucu &#8220;.ToList()&#8221; metodu ile List koleksiyonuna \u00e7evirdi\u011fimiz zaman sorunumuz \u00e7\u00f6z\u00fclecektir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n            NorthwindEntities vt = new NorthwindEntities();\r\n            Personeller p = new Personeller { Adi = &quot;Nancy&quot;, SoyAdi = &quot;Davaleo&quot; };\r\n            vt.Set&lt;Personeller&gt;().ToList().Contains(p);\r\n<\/pre>\n<p>Dikkatinizi &#8220;System.Data.Entity.DbSet&lt;T&gt;&#8221; tipine \u00e7ekmek istiyorum. \ud83d\ude09 <\/p>\n<p>Bir ba\u015fka \u00f6rne\u011fi incelersek e\u011fer,<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n            NorthwindEntities vt = new NorthwindEntities();\r\n            var Personeller = (from personel in vt.Personeller\r\n                               select personel\r\n                               ).ToList();\r\n\r\n            var Satislar = (from satislar in vt.Satislar\r\n                            where \r\n                            (Personeller.Any\r\n                            (p =&gt; p.PersonelID == satislar.PersonelID))\r\n                            select satislar).ToList();\r\n<\/pre>\n<p>Buradaki duruma g\u00f6z atarsak e\u011fer;<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-1.png\" alt=\"Entity Framework&#039;te Unable To Create A Constant Value Of Type &#039;xxx&#039;. Only Primitive Types Or Enumeration Types Are Supported In This Context Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc\" width=\"767\" height=\"164\" class=\"aligncenter size-full wp-image-5604\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-1.png 767w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-1-300x64.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/a><br \/>\n&#8220;List&lt;Personeller&gt;&#8221; ile &#8220;DbSet&lt;Satislar&gt;&#8221; koleksiyonlar\u0131 i\u00e7erisinden al\u0131nan veriler \u00fczerinde bir kar\u015f\u0131la\u015ft\u0131r\u0131lma yap\u0131lmaktad\u0131r. Bu kodu derleyip \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131m\u0131zda da a\u015fa\u011f\u0131daki aslen konumuzla alakal\u0131 durumla kar\u015f\u0131la\u015f\u0131lacakt\u0131r.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-2.png\" alt=\"Entity Framework&#039;te Unable To Create A Constant Value Of Type &#039;xxx&#039;. Only Primitive Types Or Enumeration Types Are Supported In This Context Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc\" width=\"833\" height=\"164\" class=\"aligncenter size-full wp-image-5608\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-2.png 833w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-2-300x59.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-2-768x151.png 768w\" sizes=\"auto, (max-width: 833px) 100vw, 833px\" \/><\/a><br \/>\nHaliyle tekrardan \u015faibe yaratan &#8220;DbSet&lt;T&gt;&#8221; metodu kullan\u0131lmaktad\u0131r. Yapmam\u0131z gereken kar\u015f\u0131la\u015ft\u0131rmada rol alan iki tipten birini di\u011ferine benzetmektir.<\/p>\n<table style=\"width:100%;\">\n<tr>\n<th>\n1. Yol\n<\/th>\n<th>\n2. Yol\n<\/th>\n<\/tr>\n<tr>\n<td>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-3.png\" alt=\"Entity Framework&#039;te Unable To Create A Constant Value Of Type &#039;xxx&#039;. Only Primitive Types Or Enumeration Types Are Supported In This Context Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc\" width=\"421\" height=\"162\" class=\"aligncenter size-full wp-image-5611\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-3.png 421w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-3-300x115.png 300w\" sizes=\"auto, (max-width: 421px) 100vw, 421px\" \/><\/a>\n<\/td>\n<td>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-4.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-4.png\" alt=\"Entity Framework&#039;te Unable To Create A Constant Value Of Type &#039;xxx&#039;. Only Primitive Types Or Enumeration Types Are Supported In This Context Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc\" width=\"485\" height=\"156\" class=\"aligncenter size-full wp-image-5613\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-4.png 485w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-4-300x96.png 300w\" sizes=\"auto, (max-width: 485px) 100vw, 485px\" \/><\/a>\n<\/td>\n<\/tr>\n<tr>\n<td>\nG\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere Satislar tablosunu .ToList metodu ile List<Satislar> tipine \u00e7evirebiliriz.\n<\/td>\n<td>\nYa da Personeller sorgusundaki .ToList metodunu silerek sorgu sonucunu koleksiyon olarak elde etmekten vaz ge\u00e7eriz. Haliyle g\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere IQueryable&lt;T&gt; tipinden sonucu elde ederiz.<\/p>\n<p>A\u015fa\u011f\u0131da da g\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere IQueryable&lt;T&gt; tipi aslen DbSet&lt;T&gt; referans\u0131n\u0131n Base Class&#8217;\u0131d\u0131r. O y\u00fczden amac\u0131m\u0131z olan benzerle\u015ftirme i\u015flemimiz ba\u015far\u0131l\u0131 olmu\u015ftur diyebiliriz.<\/p>\n<p><a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-5.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-5.png\" alt=\"Entity Framework&#039;te Unable To Create A Constant Value Of Type &#039;xxx&#039;. Only Primitive Types Or Enumeration Types Are Supported In This Context Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc\" width=\"782\" height=\"41\" class=\"aligncenter size-full wp-image-5616\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-5.png 782w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-5-300x16.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-5-768x40.png 768w\" sizes=\"auto, (max-width: 782px) 100vw, 782px\" \/><\/a>\n<\/td>\n<\/tr>\n<\/table>\n<p>Bu \u00f6rne\u011fimizde, DbSet&lt;T&gt; tipiyle yap\u0131lan \u00e7al\u0131\u015fmalarda dikkatli olman\u0131z gerekti\u011fini tekrardan g\u00f6stermi\u015f olmaktad\u0131r. \ud83d\ude09 <\/p>\n<p>Ve son olarak a\u015fa\u011f\u0131daki durumu inceleyelim.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n            NorthwindEntities vt = new NorthwindEntities();\r\n            var Personel = vt.Personeller.Where(p =&gt; p.PersonelID == 3).DefaultIfEmpty(new Personeller { Adi = &quot;Gen\u00e7ay&quot;, SoyAdi = &quot;Y\u0131ld\u0131z&quot; }).First();\r\n<\/pre>\n<p>Bu koduda derleyip \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131m\u0131z zaman beklenilen durumla kar\u015f\u0131la\u015fmaktay\u0131z.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-6.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-6.png\" alt=\"Entity Framework&#039;te Unable To Create A Constant Value Of Type &#039;xxx&#039;. Only Primitive Types Or Enumeration Types Are Supported In This Context Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc\" width=\"764\" height=\"50\" class=\"aligncenter size-full wp-image-5621\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-6.png 764w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-6-300x20.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/a><br \/>\nDikkat edilirse e\u011fer Personeller DbSet&lt;T&gt; iken DefaultIfEmpty metodu generic yap\u0131s\u0131ndan dolay\u0131 DbSet&lt;T&gt;&#8217;nin base class\u0131 IQueryable&lt;T&gt; olarak gelmektedir. Haliyle bu iki metod sonu\u00e7 olarak ayn\u0131d\u0131r. Ama sonuncu metodumuz First ise geriye sadece Personeller tipi d\u00f6nece\u011finden dolay\u0131 bu hata ka\u00e7\u0131n\u0131lmaz olmaktad\u0131r.<\/p>\n<p>Yapmam\u0131z gereken ortadaki tip fark\u0131n\u0131 kald\u0131rmakt\u0131r.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-7.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-7.png\" alt=\"Entity Framework&#039;te Unable To Create A Constant Value Of Type &#039;xxx&#039;. Only Primitive Types Or Enumeration Types Are Supported In This Context Hatas\u0131 ve \u00c7\u00f6z\u00fcm\u00fc\" width=\"758\" height=\"49\" class=\"aligncenter size-full wp-image-5623\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-7.png 758w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2017\/02\/Entity-Frameworkte-Unable-To-Create-A-Constant-Value-Of-Type-xxx.-Only-Primitive-Types-Or-Enumeration-Types-Are-Supported-In-This-Context-Hatas\u0131-ve-\u00c7\u00f6z\u00fcm\u00fc-7-300x19.png 300w\" sizes=\"auto, (max-width: 758px) 100vw, 758px\" \/><\/a><br \/>\nG\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere .ToList metodu sayesinde bu i\u015flemi ba\u015far\u0131yla ger\u00e7ekle\u015ftirebilmekteyiz.<\/p>\n<p>Burada da DbSet&lt;T&gt; tipiyle yap\u0131lan \u00e7al\u0131\u015fmalarda dikkatli ve tetikte olman\u0131z\u0131 bir kez daha vurgulam\u0131\u015f olal\u0131m. \ud83d\ude09 \ud83d\ude42<\/p>\n<p>Evet&#8230;<br \/>\nBir uzun ve zahmetli yaz\u0131n\u0131n daha sonuna gelmi\u015f bulunmaktay\u0131z.<br \/>\nSonraki yaz\u0131lar\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<br \/>\n\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, Ge\u00e7enlerde \u00fczerine \u00e7al\u0131\u015ft\u0131\u011f\u0131m bir projede alm\u0131\u015f oldu\u011fum bir hata \u00fczerine konu\u015fuyor olaca\u011f\u0131z. Bu hatan\u0131n di\u011ferlerinden fark\u0131 belli ba\u015fl\u0131, tespit edilebilir durumlarda kar\u015f\u0131la\u015fabilmemizden ziyade; birden fazla sergilenen yakla\u015f\u0131mda kar\u015f\u0131la\u015f\u0131labilen ve geni\u015f yelpazeli bir olas\u0131&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":3223,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,258],"tags":[963,260,1561,1083],"class_list":["post-5594","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-sharp-c","category-hata-cozumleri","tag-entity-framework","tag-hata","tag-hata-ve-cozumleri","tag-hata-ve-cozumu"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/5594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=5594"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/5594\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/3223"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=5594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=5594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=5594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}