[{"data":1,"prerenderedAt":237},["ShallowReactive",2],{"article-entity-framework-and-primary-keys":3},{"article":4,"tags":97,"previous":112,"next":155},{"id":5,"title":6,"author":7,"body":8,"createdAt":86,"description":87,"extension":88,"img":75,"meta":89,"navigation":90,"path":91,"seo":92,"stem":93,"tags":94,"updatedAt":86,"__hash__":96},"articles\u002Farticles\u002Fentity-framework-and-primary-keys.md","Entity Framework and Primary Keys","[object Object]",{"type":9,"value":10,"toc":84},"minimark",[11,15,22,58,61,80],[12,13,14],"p",{},"Entity Framework relies on primary keys with views and tables.  If you are trying to bring a view into dbContext, and the view does not have a primary key the following should help you out.  The schema object has to have primary key defined and it be set to not allow nulls (not-null).",[12,16,17,18,21],{},"The solution for me was to refashion my view definition using RowId like the following",[19,20],"br",{},"\nThis will create a non-null RowId for each row in the result.",[23,24,29],"pre",{"className":25,"code":26,"language":27,"meta":28,"style":28},"language-sql shiki shiki-themes github-light github-dark","SELECT ISNULL(ROW_NUMBER() OVER(ORDER BY P1), -1) \nAS RowID, P1 AS Code, P3, P2\nFROM dbo.BigTable \nWHERE P1 IS NOT NULL\n","sql","",[30,31,32,40,46,52],"code",{"__ignoreMap":28},[33,34,37],"span",{"class":35,"line":36},"line",1,[33,38,39],{},"SELECT ISNULL(ROW_NUMBER() OVER(ORDER BY P1), -1) \n",[33,41,43],{"class":35,"line":42},2,[33,44,45],{},"AS RowID, P1 AS Code, P3, P2\n",[33,47,49],{"class":35,"line":48},3,[33,50,51],{},"FROM dbo.BigTable \n",[33,53,55],{"class":35,"line":54},4,[33,56,57],{},"WHERE P1 IS NOT NULL\n",[12,59,60],{},"After you create the view take a look at the view definition within SQL Server Management Studio.  You should see that you have defined a column RowId which is non-null. ",[12,62,63,64,66],{},"This will satisfy Entity Framework and dbContext can now include a reference to these views or tables.",[19,65],{},[67,68,71],"a",{"style":69,"href":70},"display: none;","\u002Farticles\u002Fimages\u002Fopen-live-writer-entity-framework-and-primary-keys_eb29-ef_2.png",[72,73],"img",{"style":74,"src":75,"border":76,"alt":77,"title":77,"width":78,"height":79},"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;","\u002Farticles\u002Fimages\u002Fopen-live-writer-entity-framework-and-primary-keys_eb29-ef_thumb.png",0,"ef",240,154,[81,82,83],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":28,"searchDepth":42,"depth":42,"links":85},[],"2017-01-18T09:49:20.3800000-05:00","Entity Framework relies on primary keys with views and tables...","md",{},true,"\u002Farticles\u002Fentity-framework-and-primary-keys",{"title":6,"description":87},"articles\u002Fentity-framework-and-primary-keys",[95],"entityframework","LlkG54x3JZij2W3gLKsdJshQfKO6dv1t6tzMvSrv9wQ",[98],{"id":99,"title":100,"body":101,"description":105,"extension":88,"img":106,"meta":107,"name":95,"navigation":90,"path":108,"seo":109,"stem":110,"__hash__":111},"tags\u002Ftags\u002Fentityframework.md","Entityframework",{"type":9,"value":102,"toc":103},[],{"title":28,"searchDepth":42,"depth":42,"links":104},[],"Entity Framework is an open-source ORM framework for .NET applications supported by Microsoft. It enables developers to work with data using objects of domain specific classes without focusing on the underlying database tables and columns where this data is stored.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fentityframework",{"description":105},"tags\u002Fentityframework","OUnoZJoIvU2LISfVORR0X4iRDBwmF8VkIoyT75FfFJw",{"id":113,"title":114,"author":7,"body":115,"createdAt":146,"description":147,"extension":88,"img":125,"meta":148,"navigation":90,"path":149,"seo":150,"stem":151,"tags":152,"updatedAt":146,"__hash__":154},"articles\u002Farticles\u002Fvisual-studio-emulator-for-android.md","Visual Studio Emulator for Android",{"type":9,"value":116,"toc":144},[117,120,128],[12,118,119],{},"“The Emulator is unable to connect to the device operating system”",[67,121,123],{"href":122},"\u002Farticles\u002Fimages\u002Fopen-live-writer-visual-studio-emulator-for-android_e589-image_2.png",[72,124],{"style":74,"src":125,"border":76,"alt":126,"title":126,"width":78,"height":127},"\u002Farticles\u002Fimages\u002Fopen-live-writer-visual-studio-emulator-for-android_e589-image_thumb.png","image",157,[12,129,130,131,133,134,136],{},"The resolution was to ensure the Network Connection – Adapter “vEthernet (Internal Ethernet Port Windows Phone Emulator Internal Switch)” was enabled.",[19,132],{},"\n ",[19,135],{},[67,137,139],{"href":138},"\u002Farticles\u002Fimages\u002Fopen-live-writer-visual-studio-emulator-for-android_e589-image_6.png",[72,140],{"style":74,"src":141,"border":76,"alt":126,"title":126,"width":142,"height":143},"\u002Farticles\u002Fimages\u002Fopen-live-writer-visual-studio-emulator-for-android_e589-image_thumb_2.png",379,51,{"title":28,"searchDepth":42,"depth":42,"links":145},[],"2017-01-27T09:23:01.2100000-05:00",null,{},"\u002Farticles\u002Fvisual-studio-emulator-for-android",{"title":114,"description":147},"articles\u002Fvisual-studio-emulator-for-android",[153],"xamarin","LB6Mk4yGa0Ok9lrQNHDt5QnMwYy2Z0eiAeaCriVxOAM",{"id":156,"title":157,"author":7,"body":158,"createdAt":230,"description":147,"extension":88,"img":168,"meta":231,"navigation":90,"path":232,"seo":233,"stem":234,"tags":235,"updatedAt":230,"__hash__":236},"articles\u002Farticles\u002Fxamarin-mac-agent-unable-to-connect.md","Xamarin Mac Agent–Unable to connect",{"type":9,"value":159,"toc":228},[160,176,185,200,212,222,225],[12,161,162,171,133,173,175],{},[67,163,165],{"style":69,"href":164},"\u002Farticles\u002Fimages\u002Fopen-live-writer-0ed91d2b3197_8765-image_2.png",[72,166],{"style":167,"src":168,"border":76,"alt":126,"title":126,"width":169,"height":170},"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;","\u002Farticles\u002Fimages\u002Fopen-live-writer-0ed91d2b3197_8765-image_thumb.png",155,142,[19,172],{},[19,174],{},"\nI was unable to connect to Mac today.  Not sure why. ",[12,177,178,179,184],{},"I found this documentation from Xamarin ",[67,180,183],{"href":181,"target":182},"https:\u002F\u002Fdeveloper.xamarin.com\u002Fguides\u002Fios\u002Fgetting_started\u002Finstallation\u002Fwindows\u002Fconnecting-to-mac\u002F","_blank","here",". ",[12,186,187,188,191,192,194,195,133,197,199],{},"The document ",[67,189,183],{"href":190,"target":182},"https:\u002F\u002Fdeveloper.xamarin.com\u002Fguides\u002Fios\u002Fgetting_started\u002Finstallation\u002Fwindows\u002Fconnecting-to-mac\u002Ftroubleshooting\u002F"," gave me the solution.",[19,193],{},"\nOnce I did the following I was able to use the Xamarin Mac Agent (Visual Studio – Tools – iOS – Xamarin Mac Agent) to connect.",[19,196],{},[19,198],{},"\nNext, test if the ssh client from OpenSSH can connect successfully to the Mac from Windows. One way to install this program is to install",[12,201,202,206,207,211],{},[67,203,205],{"href":204},"https:\u002F\u002Fgit-for-windows.github.io\u002F","Git for Windows",". You can then start a ",[208,209,210],"strong",{},"Git Bash"," command prompt and attempt to ssh in to the Mac with your username and IP address",[12,213,214],{},[67,215,217],{"href":216},"\u002Farticles\u002Fimages\u002Fopen-live-writer-0ed91d2b3197_8765-image_4.png",[72,218],{"style":167,"src":219,"border":76,"alt":126,"title":126,"width":220,"height":221},"\u002Farticles\u002Fimages\u002Fopen-live-writer-0ed91d2b3197_8765-image_thumb_1.png",559,65,[12,223,224],{},"Once this was permanently added the Max Agent successfully connected. ",[12,226,227],{},"By the way I found SSH – I had Git for Windows installed, by opening GIT Shell.",{"title":28,"searchDepth":42,"depth":42,"links":229},[],"2017-01-18T02:46:11.6900000-05:00",{},"\u002Farticles\u002Fxamarin-mac-agent-unable-to-connect",{"title":157,"description":147},"articles\u002Fxamarin-mac-agent-unable-to-connect",[153],"NW9Sc0uSvm7zSo9Iy-Pw8OzJPVXNMr37ucc_BNMcgng",1781574764104]