.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Associations in EF 4.1 Code First: Part 3 - Shared Primary Key Associations

Posted By: mortezam     Posted Date: April 14, 2011    Points: 0   Category :ASP.Net
This is the third post in a series that explains entity association mappings with EF Code First. This series includes:
In the previous blog post I demonstrated how to map a special kind of one-to-one association-a composition with complex types. We argued that the relationship b

View Complete Post

More Related Resource Links

Foundations: Adding Code Access Security to WCF, Part 2


This month's column continues the discussion around code access security in WCF and partially trusted services.

Juval Lowy

MSDN Magazine July 2008

Foundations: Code Access Security in WCF, Part 1


Here we discuss code-access security in Windows Communication Foundation (WCF) and present a solution for enabling partially trusted clients for WCF services.

Juval Lowy

MSDN Magazine April 2008

Rotor: Shared Source CLI Provides Source Code for a FreeBSD Implementation of .NET


With over 9,000 files, and including some 1300 public classes to pore through, the Shared Source CLI can teach you quite a bit about the internal workings of the CLR. But the sheer amount of source code included can make just starting your exploration a monumental task. This article discusses some of the things you can learn from the source code facsimile of the CLR, like how JIT compilation works. It will also help you understand how to control execution along with debugging and loading classes. A walk through the steps involved in setting up the runtime will let you become familiar with the process.

Jason Whittington

MSDN Magazine July 2002

Creating SharePoint Server 2010 External Content Type Associations with SharePoint Designer 2010

Learn how to use Business Connectivity Services (BCS) to create associations between external content types in SharePoint Designer 2010 without using code.

Moving part of the code/processing from Asp.net hosted in IIS to WCF-Windows Services will help to r

I have a web application with no user interface (GUI), this web application (asp.net) accepts some input from a program and doing some processing; In the Page Load event I am doing all processing and calling a WCF service, after receiving the response from WCF services the page get unload before writing the processing status/result to database) this asp.net application is hosted in IIS.   The WCF services is also hosted in the same machine in windows Services where IIS is hosted, I am concern about its performance of the application which is hosted in IIS.  Should I move some part of the code (processing) to another program say Create a new WCF Services and host it in Windows Services  so that the load on IIS will be reduce?  The new WCF Services will process some part of the code which IIS used to process, so helping IIS to reduce the load.       By moving some part of code from asp.net [processing] to another program hosted in WCF- Windows Services in same machine will able to reduce the load on IIS?   Please guide me.. Thanks Shaju

SvcUtil-generated code or shared interface/data contract assembly?

If you control both service and client is there any benefit in using svcutil.exe to generate client proxies? Or is it better to share interface/data contract assembly between client and service?

Adding logic to the Search Core Results web part - Manipulation in code or XSL?

Hi,I need to manipulate the search core results web part, so that:- It will display a check box for each result- It Will have an additional button. When clicking on this button the checked results should be copied to a grid view.Do you have any idea how it can be done?I am not sure what is the correct way to do it – in the client side via the XSL Editor or in the server side with the C# code.Thank you so much for your help,Regards,SP beginner.

Error code -2068578304 When Installing Express SP1 x64 as a Part of Visual Studio 2010 Installation

Howdy! I was installing the VS 2010 on my server running Windows Server 2008 R2 x64 and all of a sudden the setup finished with " Setup completed, however, there were failures reported installing optional components. " The final status is success. The left-hand pane of the finish page reads as: The following component failed to install: Microsoft SQL Server 2008 Express Service Pack 1 (x64).   Leaving alone the fact why setup executed the custom action that tried to install SQL Server Express Edition and Compact Edition when I just asked it to install SQL components (which presumably should be SQL SMO and DMO libraries), I would like to understand what had happed to Express install.   Inspecting the .\Logs\dd_error_vs_vstdcore_100.txt file gives the following record:   [09/16/10,16:06:51] Microsoft SQL Server 2008 Express Service Pack 1 (x64): [2] Error code -2068578304 for this component is not recognized. [09/16/10,16:06:51] Microsoft SQL Server 2008 Express Service Pack 1 (x64): [2] Component Microsoft SQL Server 2008 Express Service Pack 1 (x64) returned an unexpected value. ***EndOfSession***   Further inspection of the dd_install_vs_vstdcore_100.txt provides with the info:   [09/16/10,16:02:51] Microsoft SQL Server 2008 Express Service Pack 1 (x64): GenericComponent Action: CreateProcess launched with cmd line : x:\setup\..\wcu\sse\SQLE

How does web part stores its properties when a piece of code is executed in it?



I am trying to program my first webpart based on this:


This webpart must show people who have birthdays on particular day of the month. There should be a button for each month (and one for "whole year) and button for each day (and one for "whole month") and so user can choose to show only those with birthdays in say, april 23, or whole june...

I did it this way:

Following the tutorial, i create all my controls inside the CreateChildControls() and i store references to them as properties of the webpart class. Also the class (public class BirthdayFullScreenWebPart) has properties (int chosen_month) and (int chosen_day).

Then i have have onclick for buttons that changes the chosen month and/or day web part property, based on which button was clicked.

Then i have a function "UpdateUserList" that ouptuts list of users into the webpart's table control, based on the chosen month and day. this function is called inside createchidlcontrols after all of them are created, and inside onclicks when the month/day is changed.


What i got is that the values of the variables were behaving really odd. 

In my mind, it

Reference to a non-shared member requires an object reference in code generated by ASP.NET



I am working on converting a project from C# to VB and am facing this weird issue. 1 page cannot compile and I get the reference error, but the weird thing is that the compiler shows the error as coming from ASP.NET generated code. Visual Studio shows me that error is coming from my ASPX page. I cannot seem to figure out why or where this error is occuring. Also if I take the inherits attribute out I don't get the compilation error. The code in aspx page is below:

<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="diff.view.aspx.vb"  Inherits="MR.ControlApp.diffview" MasterPageFile="~/Site1.Master"%>

<asp:Content ID="Header1" ContentPlaceHolderID="head" runat="server">

    Page: <select onchange="sel(this);">
        Dim j As Integer = 0
        While j < pageCount
           <option <%= IIf(currentPage = ( j + 1 ), "selected", "")  %> value="<%= j+1 %>"><%= j + 1 %></option>
        <%j = j + 1
        End While
    <% 'Print(); %>
    <div style="font-family: verdana; font-size: 10pt; font-weight: bold">
        MDM Data Inconsiste

Shared code


I have a public class MyShared.cs in  App_Code.  I am able to access the code in  code behind by referencing MyShared.PrepareButton(ThisButton); but I don't know how to reference it from <asp:Button/> tag. 

I would like to do something like <asp:Button OnPrerender="MyShared.PrepareButton"/>, but the compiler says the page does not contain a definition for MyShared.

I did include using MyShared; in the aspx.cs page


Can I "hard-code" a particular report in the report viewer web part?


Hi there,

I am wondering if it is possible to "hard-code" a particular report in the report viewer web part, such that this report is automatically loaded when a user visits a particular site. I am asking that question because I do not want to select the same report each time I want to view it; I just would like to have a link that will get me the report right away.

Best wishes



Code in Content Editoe Web Part - Issue


I added the following code in content editor web part.

<!-- Code to hide Tab Page Help Link -->

<script type="text/javascript">

 $(document).ready(function() {




<!-- Code to add Tabs -->

<div id="tabs">

  <ul class="tabNavigation ms-WPBody">

   <li><a href="#tab-1" class="selected ms-topnavselected"><span>TAB 1</span></a></li>

   <li><a href="#tab-2" ><span>TAB 2</span></a></li>

   <li><a href="#tab-3" ><span>TAB 3</span></a></li>

   <li><a href="#tab-4" ><span>TAB 4</span></a></li>


  <div style="clear: both"></div>


After few edits to the page, when I try to edit the code in the content editor web part, the code appeared as follows. Not sure why these jquery ids got appended everywhere. Any suggestion as a solution for this issue ?

<!-- Code to hide Tab Page Help Link --><script type="text/javascript">

 $(document).ready(function() {



<!-- Code to add Tabs --><div id="tabs"><ul cla

Provision Shared Documents List View Web Part in Site Template


I'm trying to add the Shared Documents "web part" that is part of the default Team Site template to a custom site template.  However, from what I've found this is not really a web part for Shared Documents, but a generic List View web part with Shared as the data source.  Also, I don't see where this is listed in the onet.xml file of the Team Site template (which I believe is the "sts" template, correct?).  Also, you cannot export/download the xml for this webpart from the page and when it is viewed via SP Designer, the way it is defined is not supported in an onet.xml file. 

So how do you add this webpart to a site template?

Media Web Part and "Media failed to load" (linking to shared drive)


I am looking at ways of embedding videos into the SharePoint site so our users (in multiple countries) can watch them without bloating our database or getting a massive hit on performance.

I have seen sites and books suggesting that SharePoint isn’t always the best place to store large media files, and that they should remain on a shared drive with a link to them from SharePoint. Our videos range from 1 MB - 400 MB.

With this in mind, I have copied a couple of videos to the shared drive and I’m trying to link to them  using the out-of-the-box Media Web Part (Change Media > From Address). I’m using the address file://K:/SharePoint/VideoName.mp4. One of these videos is a Microsoft video (55 MB) and the other is one of my own screen recordings (1.2 MB). I used

How to import SQL Server Reporting Services Report Viewer Webpart on web part Page using code in Sha


Hi Every One,

I have use SQL Server Reporting Service in SharePoint integrated mode. I have deployed all reports and data source in SharePoint Document Library using CODE. I need to show those report in “SQL Server Reporting Services Report Viewer” Web Part on Web Part Page, I have created Web Part page by code. But I cannot import this Web Part on Page using Code.

How I can do this by code.


Navaratan Sharma

Foreign Key Drop downlist available in edit mode even though part of primary key


I am using Dynamic Data 4 in VS2010 with EF4.

So I have noticed and read that DD using Entity Framework does not allow editing of primary keys in a scaffolded table...fair enough...I don't know if its a difference between developing in SQL Server vs Oracle but often in our database we use composite primary keys that consists of several columns in a table (as in not generated ids, or unique ids as the primary key).  
So I have a table that has a primary key that that consists of two text fields and a foreign key from another table.  I have a custom entity template that i use to insert new records into the table.  When I select new, I get the desired behavior of a dropdown for the foreign key field to pick to insert a new record.  That works great.  When I select edit on a row in the table, I still get that dropdown!  Of course if I select a different entry from the dropdown DD yells at me since the foreign key field is part

So I have noti

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend