VS not create file version number - vb.net

I have created a COM DLL, and it does have AssemblyInfo.vb
However, its version number is not exposed, and I GetFileVersionInfoSize fails:
The contents of AssemblyInfo.vb is the following:
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("NetRTB")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("tws")>
<Assembly: AssemblyProduct("NetRTB")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
<Assembly: ComVisible(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("e696c3f8-a01d-4bf8-b645-f179228e4c5f")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.1.1.1")>
<Assembly: AssemblyFileVersion("1.1.1.1")>
What could I check?
Thank you!
Edit:
Some code:
Imports Microsoft.InteropFormTools
#If COM_INTEROP_ENABLED Then
'Adds the InteropToolbox to the My namespace
Namespace My
'The HideModuleNameAttribute hides the module name MyInteropToolbox so the syntax becomes My.InteropToolbox.
<Global.Microsoft.VisualBasic.HideModuleName()> _
Module MyInteropToolbox
Private _toolbox As New InteropToolbox
Public ReadOnly Property InteropToolbox() As InteropToolbox
Get
Return _toolbox
End Get
End Property
End Module
End Namespace
'Helper routines to do additional registration needed by ActiveX controls.
Friend Module ComRegistration
Const OLEMISC_RECOMPOSEONRESIZE As Integer = 1
Const OLEMISC_CANTLINKINSIDE As Integer = 16
Const OLEMISC_INSIDEOUT As Integer = 128
Const OLEMISC_ACTIVATEWHENVISIBLE As Integer = 256
Const OLEMISC_SETCLIENTSITEFIRST As Integer = 131072
Public Sub RegisterControl(ByVal t As Type)
Try
GuardNullType(t, "t")
GuardTypeIsControl(t)
'CLSID
Dim key As String = "CLSID\" & t.GUID.ToString("B")
Using subkey As RegistryKey = Registry.ClassesRoot.OpenSubKey(key, True)
'InProcServer32
Dim InprocKey As RegistryKey = subkey.OpenSubKey("InprocServer32", True)
If InprocKey IsNot Nothing Then
InprocKey.SetValue(Nothing, Environment.SystemDirectory & "\mscoree.dll")
End If
'Control
Using controlKey As RegistryKey = subkey.CreateSubKey("Control")
End Using
'Misc
Using miscKey As RegistryKey = subkey.CreateSubKey("MiscStatus")
Dim MiscStatusValue As Integer = OLEMISC_RECOMPOSEONRESIZE + _
OLEMISC_CANTLINKINSIDE + OLEMISC_INSIDEOUT + _
OLEMISC_ACTIVATEWHENVISIBLE + OLEMISC_SETCLIENTSITEFIRST
miscKey.SetValue("", MiscStatusValue.ToString, RegistryValueKind.String)
End Using
'ToolBoxBitmap32
Using bitmapKey As RegistryKey = subkey.CreateSubKey("ToolBoxBitmap32")
'If you want to have different icons for each control in this assembly
'you can modify this section to specify a different icon each time.
'Each specified icon must be embedded as a win32resource in the
'assembly; the default one is at index 101, but you can additional ones.
bitmapKey.SetValue("", Assembly.GetExecutingAssembly.Location & ", 101", _
RegistryValueKind.String)
End Using
'TypeLib
Using typeLibKey As RegistryKey = subkey.CreateSubKey("TypeLib")
Dim libId As Guid = Marshal.GetTypeLibGuidForAssembly(t.Assembly)
typeLibKey.SetValue("", libId.ToString("B"), RegistryValueKind.String)
End Using
'Version
Using versionKey As RegistryKey = subkey.CreateSubKey("Version")
Dim major, minor As Integer
Marshal.GetTypeLibVersionForAssembly(t.Assembly, major, minor)
versionKey.SetValue("", String.Format("{0}.{1}", major, minor))
End Using
End Using
Catch ex As Exception
LogAndRethrowException("ComRegisterFunction failed.", t, ex)
End Try
End Sub
Public Sub UnregisterControl(ByVal t As Type)
Try
GuardNullType(t, "t")
GuardTypeIsControl(t)
'CLSID
Dim key As String = "CLSID\" & t.GUID.ToString("B")
Registry.ClassesRoot.DeleteSubKeyTree(key)
Catch ex As Exception
LogAndRethrowException("ComUnregisterFunction failed.", t, ex)
End Try
End Sub
Private Sub GuardNullType(ByVal t As Type, ByVal param As String)
If t Is Nothing Then
Throw New ArgumentException("The CLR type must be specified.", param)
End If
End Sub
Private Sub GuardTypeIsControl(ByVal t As Type)
If Not GetType(Control).IsAssignableFrom(t) Then
Throw New ArgumentException("Type argument must be a Windows Forms control.")
End If
End Sub
Private Sub LogAndRethrowException(ByVal message As String, ByVal t As Type, ByVal ex As Exception)
Try
If t IsNot Nothing Then
message &= vbCrLf & String.Format("CLR class '{0}'", t.FullName)
End If
Throw New ComRegistrationException(message, ex)
Catch ex2 As Exception
My.Application.Log.WriteException(ex2)
End Try
End Sub
End Module
<Serializable()> _
Public Class ComRegistrationException
Inherits Exception
Public Sub New()
End Sub
Public Sub New(ByVal message As String, ByVal inner As Exception)
MyBase.New(message, inner)
End Sub
End Class
'Helper functions to convert common COM types to their .NET equivalents
<ComVisible(False)> _
Friend Class ActiveXControlHelpers
Inherits System.Windows.Forms.AxHost
Friend Sub New()
MyBase.New(Nothing)
End Sub
Friend Shared Shadows Function GetColorFromOleColor(ByVal oleColor As Integer) As Color
Return AxHost.GetColorFromOleColor(CIntToUInt(oleColor))
End Function
Friend Shared Shadows Function GetOleColorFromColor(ByVal color As Color) As Integer
Return CUIntToInt(AxHost.GetOleColorFromColor(color))
End Function
Friend Shared Function CUIntToInt(ByVal uiArg As UInteger) As Integer
If uiArg <= Integer.MaxValue Then
Return CInt(uiArg)
End If
Return CInt(uiArg - 2 * (CUInt(Integer.MaxValue) + 1))
End Function
Friend Shared Function CIntToUInt(ByVal iArg As Integer) As UInteger
If iArg < 0 Then
Return CUInt(UInteger.MaxValue + iArg + 1)
End If
Return CUInt(iArg)
End Function
Private Const KEY_PRESSED As Integer = &H1000
Private Declare Function GetKeyState Lib "user32" Alias "GetKeyState" (ByVal ByValnVirtKey As Integer) As Short
Private Shared Function CheckForAccessorKey() As Integer
If My.Computer.Keyboard.AltKeyDown Then
For i As Integer = Keys.A To Keys.Z
If (GetKeyState(i) And KEY_PRESSED) <> 0 Then
Return i
End If
Next
End If
Return -1
End Function
<ComVisible(False)> _
Friend Shared Sub HandleFocus(ByVal f As UserControl)
If My.Computer.Keyboard.AltKeyDown Then
HandleAccessorKey(f.GetNextControl(Nothing, True), f)
Else
'Move to the first control that can receive focus, taking into account
'the possibility that the user pressed <Shift>+<Tab>, in which case we
'need to start at the end and work backwards.
Dim ctl As Control = f.GetNextControl(Nothing, Not My.Computer.Keyboard.ShiftKeyDown)
While ctl IsNot Nothing
If ctl.Enabled AndAlso ctl.CanSelect Then
ctl.Focus()
Exit While
Else
ctl = f.GetNextControl(ctl, Not My.Computer.Keyboard.ShiftKeyDown)
End If
End While
End If
End Sub
Private Shared Sub HandleAccessorKey(ByVal sender As Object, ByVal f As UserControl)
Dim key As Integer = CheckForAccessorKey()
If key = -1 Then Return
Dim ctlCurrent As Control = f.GetNextControl(CType(sender, Control), False)
Do
ctlCurrent = f.GetNextControl(ctlCurrent, True)
If ctlCurrent IsNot Nothing AndAlso Control.IsMnemonic(ChrW(key), ctlCurrent.Text) Then
'VB6 handles conflicts correctly already, so if we handle it also we'll end up
'one control past where the focus should be
If Not KeyConflict(ChrW(key), f) Then
'If we land on a label or other non-selectable control then go to the next
'control in the tab order
If Not ctlCurrent.CanSelect Then
Dim ctlAfterLabel As Control = f.GetNextControl(ctlCurrent, True)
If ctlAfterLabel IsNot Nothing AndAlso ctlAfterLabel.CanFocus Then
ctlAfterLabel.Focus()
End If
Else
ctlCurrent.Focus()
End If
Exit Do
End If
End If
'Loop until we hit the end of the tab order
'If we've hit the end of the tab order we don't want to loop back because the
'parent form's controls come next in the tab order.
Loop Until ctlCurrent Is Nothing
End Sub
Private Shared Function KeyConflict(ByVal key As Char, ByVal u As UserControl) As Boolean
Dim flag As Boolean = False
For Each ctl As Control In u.Controls
If Control.IsMnemonic(key, ctl.Text) Then
If flag Then Return True
flag = True
End If
Next
Return False
End Function
'Handles <Tab> and <Shift>+<Tab>
Friend Shared Sub TabHandler(ByVal sender As Object, ByVal e As KeyEventArgs)
If e.KeyCode = Keys.Tab Then
Dim ctl As Control = CType(sender, Control)
Dim userCtl As UserControl = GetParentUserControl(ctl)
Dim firstCtl As Control = userCtl.GetNextControl(Nothing, True)
Do Until (firstCtl Is Nothing OrElse firstCtl.CanSelect)
firstCtl = userCtl.GetNextControl(firstCtl, True)
Loop
Dim lastCtl As Control = userCtl.GetNextControl(Nothing, False)
Do Until (lastCtl Is Nothing OrElse lastCtl.CanSelect)
lastCtl = userCtl.GetNextControl(lastCtl, False)
Loop
If ctl Is lastCtl OrElse ctl Is firstCtl OrElse _
lastCtl.Contains(ctl) OrElse firstCtl.Contains(ctl) Then
userCtl.SelectNextControl(CType(sender, Control), lastCtl Is userCtl.ActiveControl, _
True, True, True)
End If
End If
End Sub
Private Shared Function GetParentUserControl(ByVal ctl As Control) As UserControl
If ctl Is Nothing Then Return Nothing
Do Until ctl.Parent Is Nothing
ctl = ctl.Parent
Loop
If ctl IsNot Nothing Then
Return DirectCast(ctl, UserControl)
End If
Return Nothing
End Function
Friend Shared Sub WireUpHandlers(ByVal ctl As Control, ByVal ValidationHandler As EventHandler)
If ctl IsNot Nothing Then
AddHandler ctl.KeyDown, AddressOf ActiveXControlHelpers.TabHandler
AddHandler ctl.LostFocus, ValidationHandler
If ctl.HasChildren Then
For Each child As Control In ctl.Controls
WireUpHandlers(child, ValidationHandler)
Next
End If
End If
End Sub
End Class
#End If
Edit:
This is the contents of the vbproj file as requested:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Current">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{88F3765B-0831-4323-A217-62D828BF4EEA}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>NetRTB</RootNamespace>
<AssemblyName>WinformsRichTextBox</AssemblyName>
<MyType>Windows</MyType>
<Win32Resource>InteropUserControl.res</Win32Resource>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>WinformsRichTextBox.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
<DefineConstants>COM_INTEROP_ENABLED=True</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
<RegisterForComInterop>true</RegisterForComInterop>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>WinformsRichTextBox.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
<DefineConstants>COM_INTEROP_ENABLED=True</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
<RegisterForComInterop>true</RegisterForComInterop>
</PropertyGroup>
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>COM_INTEROP_ENABLED=True</DefineConstants>
<DocumentationFile>WinformsRichTextBox.xml</DocumentationFile>
<RegisterForComInterop>true</RegisterForComInterop>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>COM_INTEROP_ENABLED=True</DefineConstants>
<DocumentationFile>WinformsRichTextBox.xml</DocumentationFile>
<Optimize>true</Optimize>
<RegisterForComInterop>true</RegisterForComInterop>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.InteropFormTools">
<HintPath>packages\interopformsredist.1.0.0\lib\net20\Microsoft.InteropFormTools.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Runtime.InteropServices" />
<Import Include="System.Windows.Forms" />
<Import Include="System.ComponentModel" />
<Import Include="System.Drawing" />
<Import Include="System.Reflection" />
<Import Include="System.Runtime.CompilerServices" />
<Import Include="System.Security.Permissions" />
<Import Include="Microsoft.Win32" />
</ItemGroup>
<ItemGroup>
<Compile Include="ActiveXControlHelpers.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="WinformsRTB.Designer.vb">
<DependentUpon>WinformsRTB.vb</DependentUpon>
</Compile>
<Compile Include="WinformsRTB.vb">
<SubType>UserControl</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="InteropUserControl.bmp" />
<Content Include="InteropUserControl.rc">
<DependentUpon>InteropUserControl.manifest</DependentUpon>
</Content>
<None Include="InteropUserControl.manifest" />
<None Include="InteropUserControl.res">
<DependentUpon>InteropUserControl.manifest</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{94E38DFF-614B-4CBD-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WinformsRTB.resx">
<DependentUpon>WinformsRTB.vb</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent>#echo.
IF EXIST "$(DevEnvDir)..\..\SDK\v3.5\Bin\rc.exe" ("$(DevEnvDir)..\..\SDK\v3.5\Bin\rc.exe" /r "$(ProjectDir)InteropUserControl.rc") ELSE (IF EXIST "$(DevEnvDir)..\..\SDK\v2.0\Bin\rc.exe" ("$(DevEnvDir)..\..\SDK\v2.0\Bin\rc.exe"/r "$(ProjectDir)InteropUserControl.rc") ELSE (IF EXIST "$(DevEnvDir)..\Tools\Bin\rc.exe" ("$(DevEnvDir)..\Tools\Bin\rc.exe"/r "$(ProjectDir)InteropUserControl.rc") ELSE (IF EXIST "$(DevEnvDir)..\..\VC\Bin\rc.exe" ("$(DevEnvDir)..\..\VC\Bin\rc.exe"/r "$(ProjectDir)InteropUserControl.rc") ELSE (#Echo Unable to find rc.exe, using default manifest instead))))
#echo.</PreBuildEvent>
</PropertyGroup>
</Project>

Thanks to a comment I have found a solution:
The < Win32Resource > in my project was empty anyways, so I just removed this line.
Now it works.

Related

VB.NET Deserialize XML sub nodes by attribute text

Trying to deserialize an XML file but having trouble with sub nodes.
I need to collect these by there ID value eg ConNum, class, recid.
Currently I can get one value back but it's giving me the name of the ID and not the value.
eg: xData.TRAN_DATEX.theTarget = ConNum where I require 20190910 instead.
Here's the XML:
<?xml version="1.0" encoding="UTF-8"?>
<targets>
<target id="ConNum">20190910</target>
<target id="class">Third</target>
<target id="recid">123 </target>
</targets>
Here's my class:
Imports System.Xml.Serialization
<Serializable, XmlRoot("targets")>
Public Class XmlFile
<XmlElement("target")> Public Property TRAN_DATEX As myTarget
End Class
<Serializable, XmlRoot("target")>
Public Class myTarget
<XmlAttribute("id")> Public theTarget As String
End Class
And here is the deserialize method:
Dim fFile As FileInfo = New FileInfo("C:\Temp\TARGETS.metadata")
Dim s As New XmlSerializer(GetType(XmlFile))
Using sr As New StreamReader(fFile.FullName)
xData = s.Deserialize(sr)
Stop
End Using
theTarget is getting the value of the id attribute. You want the XmlText of that element:
<Serializable, XmlRoot("target")>
Public Class myTarget
<XmlAttribute("id")> Public theTarget As String
<XmlText> Public Property theValue As String
End Class
Then, instead of xData.TRAN_DATEX.theTarget, you can use xData.TRAN_DATEX.theValue
Edit: In response to the comment.
As there are multiple <target> elements, TRAN_DATEX will need to be a list:
<Serializable, XmlRoot("targets")>
Public Class XmlFile
<XmlElement("target")> Public Property TRAN_DATEX As New List(Of myTarget)
End Class
LINQ can be used to access the data that is required:
Dim reqValueTarget = xData.TRAN_DATEX.FirstOrDefault(Function(x) x.theTarget = "ConNum")
If reqValueTarget IsNot Nothing then
Dim reqValue = reqValueTarget.theValue
End If

Retrieving keys from custom config section group in .config file

I have a App.config file, where I declared a section group ListOfItems and 2 sections Item_A and Item_B:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="ListOfItems">
<section name="Item_A" type="System.Configuration.AppSettingsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<section name="Item_B" type="System.Configuration.AppSettingsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
</startup>
<ListOfItems>
<Item_A>
<add key="FileAddress" value="http://www.example.com/file1.xml"/>
<add key="FileType" value="xml"/>
<add key="DateFieldFormat" value="yyyy/MM/dd"/>
<add key="MainFolder" value="Folder_A"/>
<add key="OutputFolder" value="output"/>
<add key="ArchiveFolder" value="archive"/>
</Item_A>
<Item_B>
<add key="FileAddress" value="http://www.example.com/file2.txt"/>
<add key="FileType" value="txt"/>
<add key="DateFieldFormat" value="yyyy-MM-dd"/>
<add key="MainFolder" value="Folder_B"/>
<add key="OutputFolder" value="output"/>
<add key="ArchiveFolder" value="archive"/>
</Item_B>
</ListOfItems>
</configuration>
Then I defined a class with properties:
Namespace DataTypes
Friend Class ItemObject
Inherits ConfigurationSection
<ConfigurationProperty("FileAddress", DefaultValue:=Nothing, IsRequired:=True)>
Public Property FileAddressProperty As String
Get
Return CType(Me("FileAddress"), String)
End Get
Protected Friend Set(ByVal value As String)
Me("FileAddress") = value
End Set
End Property
<ConfigurationProperty("FileType", DefaultValue:="xml", IsRequired:=True)>
Public Property FileTypeProperty As String
Get
Return CType(Me("FileType"), String)
End Get
Protected Friend Set(ByVal value As String)
Me("FileType") = value
End Set
End Property
<ConfigurationProperty("DateFieldFormat", DefaultValue:="yyyy/MM/dd", IsRequired:=True)>
Public Property DateFieldFormatProperty As String
Get
Return CType(Me("DateFieldFormat"), String)
End Get
Protected Friend Set(ByVal value As String)
Me("DateFieldFormat") = value
End Set
End Property
<ConfigurationProperty("MainFolder", DefaultValue:="Folder", IsRequired:=True)>
Public Property MainFolderProperty As String
Get
Return CType(Me("MainFolder"), String)
End Get
Protected Friend Set(ByVal value As String)
Me("MainFolder") = value
End Set
End Property
<ConfigurationProperty("OutputFolder", DefaultValue:="output", IsRequired:=True)>
Public Property OutputFolderProperty As String
Get
Return CType(Me("OutputFolder"), String)
End Get
Protected Friend Set(ByVal value As String)
Me("OutputFolder") = value
End Set
End Property
<ConfigurationProperty("ArchiveFolder", DefaultValue:="archive", IsRequired:=True)>
Public Property ArchiveFolderProperty As String
Get
Return CType(Me("ArchiveFolder"), String)
End Get
Protected Friend Set(ByVal value As String)
Me("ArchiveFolder") = value
End Set
End Property
End Class
End Namespace
Now I have looked here and here, but I cannot figure out how to write the following loop:
Foreach item in ListOfItems, create an ItemObject with data from App.config (I would add it to a list of ItemObjects. So I would have a list with 2 items in it, one for Item_A and one for Item_B

Option Strict Off in compiler generated Reference.vb file

What causes the vb.net compiler to add Option Strict Off to the Reference.vb file created for asmx web references? Sometimes it's there and sometimes it's not, and it never seems to be necessary.
As the file is has a header similar (your version number may differ) to this:
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
and the first to statements are:
Option Strict Off
Option Explicit On
I would say that the tool that generates the file is using the VBCodeProvider Class to produce the code using the CodeCompileUnit Class and that author of the tool did not override the defaults for the UserData items AllowLateBound and RequireVariableDeclaration.
The code for the Microsoft.VisualBasic.VBCodeGenerator.GenerateCompileUnitStart method obtained using Reflector is as follows.
Protected Overrides Sub GenerateCompileUnitStart(ByVal e As CodeCompileUnit)
MyBase.GenerateCompileUnitStart(e)
MyBase.Output.WriteLine("'------------------------------------------------------------------------------")
MyBase.Output.Write("' <")
MyBase.Output.WriteLine(SR.GetString("AutoGen_Comment_Line1"))
MyBase.Output.Write("' ")
MyBase.Output.WriteLine(SR.GetString("AutoGen_Comment_Line2"))
MyBase.Output.Write("' ")
MyBase.Output.Write(SR.GetString("AutoGen_Comment_Line3"))
MyBase.Output.WriteLine(Environment.Version.ToString)
MyBase.Output.WriteLine("'")
MyBase.Output.Write("' ")
MyBase.Output.WriteLine(SR.GetString("AutoGen_Comment_Line4"))
MyBase.Output.Write("' ")
MyBase.Output.WriteLine(SR.GetString("AutoGen_Comment_Line5"))
MyBase.Output.Write("' </")
MyBase.Output.WriteLine(SR.GetString("AutoGen_Comment_Line1"))
MyBase.Output.WriteLine("'------------------------------------------------------------------------------")
MyBase.Output.WriteLine("")
If Me.AllowLateBound(e) Then
MyBase.Output.WriteLine("Option Strict Off")
Else
MyBase.Output.WriteLine("Option Strict On")
End If
If Not Me.RequireVariableDeclaration(e) Then
MyBase.Output.WriteLine("Option Explicit Off")
Else
MyBase.Output.WriteLine("Option Explicit On")
End If
MyBase.Output.WriteLine()
End Sub
...
Protected Function AllowLateBound(ByVal e As CodeCompileUnit) As Boolean
Dim obj2 As Object = e.UserData.Item("AllowLateBound")
If ((Not obj2 Is Nothing) AndAlso TypeOf obj2 Is Boolean) Then
Return CBool(obj2)
End If
Return True
End Function
Protected Function RequireVariableDeclaration(ByVal e As CodeCompileUnit) As Boolean
Dim obj2 As Object = e.UserData.Item("RequireVariableDeclaration")
If ((Not obj2 Is Nothing) AndAlso TypeOf obj2 Is Boolean) Then
Return CBool(obj2)
End If
Return True
End Function

Custom config section handler can't find handler

I'm creating configSections in app.config with my custom handler AbraMain.MyConfigHandler
Error:
Could not load type 'AbraMain.MyConfigHandler.ApplicationListCollection' from assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.":"AbraMain.MyConfigHandler.ApplicationListCollection"
app.config
<configuration>
<configSections>
<section name="applicationList" type ="AbraMain.MyConfigHandler.ApplicationListCollection"/>
</configSections>
<applicationList>
<add name="Abra Backup" index="0" iconIndex="0" desc="AbraBackup"/>
<add name="Abra Backup" index="0" iconIndex="0" desc="AbraBackup"/>
</applicationList>
</configuration>
MyConfigHandler.vb
Namespace MyConfigHandler
'Desc : Individual Application configuration Class
'Handle Tag : App.config -> <applicationList> -> <add>
Public Class ApplInfoConfig
Inherits ConfigurationElement
<ConfigurationProperty("name", IsRequired:=True)> _
Public Property name() As String
Get
Return CStr(Me("name"))
End Get
Set(ByVal value As String)
Me("name") = value
End Set
End Property
<ConfigurationProperty("desc", DefaultValue:="", IsRequired:=False)> _
Public Property desc() As String
Get
Return CStr(Me("desc"))
End Get
Set(ByVal value As String)
Me("desc") = value
End Set
End Property
<ConfigurationProperty("subPath", DefaultValue:="", IsRequired:=False)> _
Public Property subPath() As String
Get
Return CStr(Me("subPath"))
End Get
Set(ByVal value As String)
Me("subPath") = value
End Set
End Property
<ConfigurationProperty("index", IsRequired:=True)> _
Public Property index() As Integer
Get
Return Me("index")
End Get
Set(ByVal value As Integer)
Me("index") = value
End Set
End Property
<ConfigurationProperty("iconIndex", DefaultValue:="0", IsRequired:=False)> _
Public Property iconIndex() As Integer
Get
Return Me("iconIndex")
End Get
Set(ByVal value As Integer)
Me("iconIndex") = value
End Set
End Property
End Class
'Desc : Collection of Individual Application configuration Class
'Handle Tag : App.config -> <applicationList>
Public Class ApplicationListCollection
Inherits ConfigurationElementCollection
Protected Overloads Overrides Function CreateNewElement() As System.Configuration.ConfigurationElement
Return New ApplInfoConfig()
End Function
Protected Overrides Function GetElementKey(ByVal element As System.Configuration.ConfigurationElement) As Object
Return CType(element, ApplInfoConfig).name()
End Function
End Class
End Namespace
It seems that the problem is in the app.config on the line where you specify the handler for your custom section:
<section name="applicationList" type ="AbraMain.MyConfigHandler.ApplicationListCollection"/>
The type declaration for your custom handler type also needs to include the assembly in which it can be found. Otherwise, it will try to find it in the default System.Configuration assembly. That is also what the error message that you got said.
So you can solve it by including the name of your assembly as well. I am assuming your assembly is named AbraMain. Then you need to change that line to:
<section name="applicationList" type ="AbraMain.MyConfigHandler.ApplicationListCollection, AbraMain"/>
However, you seem to have a second problem. For a configuration section, you need to have a handler that implements ConfigurationSection.
So you need to add a new class to do that:
Public Class ApplicationList
Inherits ConfigurationSection
' You need to do the implementation. There are plenty of
' examples available on-line.
End Class
And then point your app.config to use it:
<section name="applicationList" type ="AbraMain.MyConfigHandler.ApplicationList, AbraMain"/>

How does one get the table-column name for a complex property of an entity? (VB 2010/EF4)

I've written the following code (VB 2010/EF 4) for getting storage (database) table/column names from (conceptual) entity/property names:
Imports System.Data.Objects
Imports System.Data.Entity
Imports System.Data.SqlClient
Imports System.Data.EntityClient
Imports System.Data.Metadata.Edm
Imports System.Data.Objects.DataClasses
Imports System.Linq.Expressions
Imports System.Runtime.Serialization
Imports System.Reflection
Public Class ConvertConceptualToStore
Private Shared Function GetTableName(Of T As EntityObject)() As String
Dim type As Type = GetType(T) : Dim at = GetAttribute(Of EdmEntityTypeAttribute)(type)
Return at.Name
End Function
Private Shared Function GetColumnName(Of T As EntityObject) _
(ByVal propertySelector As Expression(Of Func(Of T, Object))) As String
If propertySelector Is Nothing Then
Throw New Exception("""" & propertySelector.ToString & """ is null.")
End If
Dim propertyInfo As PropertyInfo = GetPropertyInfo(propertySelector.Body)
Dim attribute As DataMemberAttribute = _
GetAttribute(Of DataMemberAttribute)(propertyInfo)
If String.IsNullOrEmpty(attribute.Name) Then
Return propertyInfo.Name
Else
Return attribute.Name
End If
End Function
Private Shared Function GetAttribute(Of T As Class) (ByVal memberInfo As MemberInfo) As T
If memberInfo Is Nothing Then
Throw New Exception("""" & memberInfo.ToString & """ is null.")
End If
Dim customAttributes() As Object = _
memberInfo.GetCustomAttributes(GetType(T), False)
Dim attribute As T = _
DirectCast(customAttributes.Where(Function(a) TypeOf a Is T).First(), T)
Return attribute
End Function
Private Shared Function GetPropertyInfo(ByVal propertySelector As Expression) As PropertyInfo
If propertySelector Is Nothing Then
Throw New Exception("""" & propertySelector.ToString & """ is null.")
End If
Dim memberExpression As MemberExpression = _
TryCast(propertySelector, MemberExpression)
If memberExpression Is Nothing Then
Dim unaryExpression As UnaryExpression = _
TryCast(propertySelector, UnaryExpression)
If unaryExpression IsNot Nothing _
AndAlso unaryExpression.NodeType = ExpressionType.Convert Then
memberExpression = TryCast(unaryExpression.Operand, MemberExpression)
End If
End If
If memberExpression IsNot Nothing _
AndAlso memberExpression.Member.MemberType = MemberTypes.Property Then
Return DirectCast(memberExpression.Member, PropertyInfo)
Else
Throw New ArgumentException("No property reference was found.", "propertySelector")
End If
End Function
' Invocation example
'Public Shared Function Test()
'Dim table As String = GetTableName(Of User)()
'Dim column As String = GetColumnName(Of User)(Function(u) u.Name)
'End Function
End Class
QUESTIONS:
Am I correct in assuming that the code DOESN'T require an ObjectContext or
Data.CSSpace?
What if a column is a component of a Complex property? Should one do anything
different then? (i.e., If Location is an entity with a complex property named
Address, then how does one get the column name for, say, Address.Street?)
Here's a general-purpose algorithm for converting between conceptual and store information, written in Visual Basic 2010.
I have written a new routine that to convert an entity/property pair into a table/column pair. This class, MSLMappingAction, takes in its constructor the model name and either an XElement XML tree, an MSL mapping file, or an XML string. One then uses the ConceptualToStore method to take String specifying entity and property "expressions" (stored in the MSLConceptualInfo structure) and find the table and column names (stored in the MSLStoreInfo structure).
Notes:
One could also write a "StoreToConceptual" method to convert in
the other direction, but the XML queries would probably be a bit
more complex. The same goes for handling
navigation-propery/function/stored-procedure mappings.
Beware inherited properties of derived entities! If a property is
not specific to the derived entity, then you should use the base
entity's name.)
Here's the code.
Host code: (For the XML sample given [see bottom], it returns table name "Locations" and column name "Address_Street" for the store information when given the entity "Location" and the property expression "Address.Street" [and the conceptual model name "SCTModel"]):
Dim MSL As MSLMappingAction = New MSLMappingAction(".\SCTModel.msl", "SCTModel")
Dim ConceptualInfo As MSLConceptualInfo = New MSLConceptualInfo With {.EntityName = "Location", .PropertyName = "Address.Street"}
Dim StoreInfo As MSLStoreInfo = MSL.ConceptualToStore(ConceptualInfo)
MessageBox.Show(StoreInfo.TableName & ": " & StoreInfo.ColumnName)
Class code:
Option Infer On
Imports System.Xml.Linq
''' <summary>
''' This class allows one to convert between an EF conceptual model's entity/property pair
''' and its database store's table/column pair.
''' </summary>
''' <remarks>It takes into account entity splitting and complex-property designations;
''' it DOES NOT take into account inherited properties
''' (in such a case, you should access the entity's base class)</remarks>
Public Class MSLMappingAction
' private fields and routines
Private mmaMSLMapping As XElement
Private mmaModelName, mmaNamespace As String
Private Function FullElementName(ByVal ElementName As String) As String
' pre-pend Namespace to ElementName
Return "{" & mmaNamespace & "}" & ElementName
End Function
Private Sub ValidateParams(ByVal MappingXML As XElement, Byval ModelName As String)
' verify that model name is specified
If String.IsNullOrEmpty(ModelName) Then
Throw New EntityException("Entity model name is not given!")
End If
' verify that we're using C-S space
If MappingXML.#Space <> "C-S" Then
Throw New MetadataException("XML is not C-S mapping data!")
End If
' get Namespace and set private variables
mmaNamespace = MappingXML.#xmlns
mmaMSLMapping = MappingXML : mmaModelName = ModelName
End Sub
Private Function IsSequenceEmpty(Items As IEnumerable(Of XElement)) As Boolean
' determine if query result is empty
Return _
Items Is Nothing OrElse Items.Count = 0
End Function
' properties
''' <summary>
''' Name of conceptual entity model
''' </summary>
''' <returns>Conceptual-model String</returns>
''' <remarks>Model name can only be set in constructor</remarks>
Public ReadOnly Property EntityModelName() As String
Get
Return mmaModelName
End Get
End Property
''' <summary>
''' Name of mapping namespace
''' </summary>
''' <returns>Namespace String of C-S mapping layer</returns>
''' <remarks>This value is determined when the XML mapping
''' is first parsed in the constructor</remarks>
Public ReadOnly Property MappingNamespace() As String
Get
Return mmaNamespace
End Get
End Property
' constructors
''' <summary>
''' Get C-S mapping information for an entity model (with XML tree)
''' </summary>
''' <param name="MappingXML">XML mapping tree</param>
''' <param name="ModelName">Conceptual-model name</param>
''' <remarks></remarks>
Public Sub New(ByVal MappingXML As XElement, ByVal ModelName As String)
ValidateParams(MappingXML, ModelName)
End Sub
''' <summary>
''' Get C-S mapping information for an entity model (with XML file)
''' </summary>
''' <param name="MSLFile">MSL mapping file</param>
''' <param name="ModelName">Conceptual-model name</param>
''' <remarks></remarks>
Public Sub New(ByVal MSLFile As String, ByVal ModelName As String)
Dim MappingXML As XElement = XElement.Load(MSLFile)
ValidateParams(MappingXML, ModelName)
End Sub
' methods
''' <summary>
''' Get C-S mapping infomration for an entity model (with XML String)
''' </summary>
''' <param name="XMLString">XML mapping String</param>
''' <param name="ModelName">Conceptual-model name</param>
''' <returns></returns>
Public Shared Function Parse(ByVal XMLString As String, ByVal ModelName As String)
Return New MSLMappingAction(XElement.Parse(XMLString), ModelName)
End Function
''' <summary>
''' Convert conceptual entity/property information into store table/column information
''' </summary>
''' <param name="ConceptualInfo">Conceptual-model data
''' (.EntityName = entity expression String, .PropertyName = property expression String)</param>
''' <returns>Store data (.TableName = table-name String, .ColumnName = column-name String)</returns>
''' <remarks></remarks>
Public Function ConceptualToStore(ByVal ConceptualInfo As MSLConceptualInfo) As MSLStoreInfo
Dim StoreInfo As New MSLStoreInfo
With ConceptualInfo
' prepare to query XML
If Not .EntityName.Contains(".") Then
' make sure entity name is fully qualified
.EntityName = mmaModelName & "." & .EntityName
End If
' separate property names if there's complex-type nesting
Dim Properties() As String = .PropertyName.Split(".")
' get relevant entity mapping
Dim MappingInfo As IEnumerable(Of XElement) = _
(From mi In mmaMSLMapping.Descendants(FullElementName("EntityTypeMapping")) _
Where mi.#TypeName = "IsTypeOf(" & .EntityName & ")" _
OrElse mi.#TypeName = .EntityName _
Select mi)
' make sure entity is in model
If IsSequenceEmpty(MappingInfo) Then
Throw New EntityException("Entity """ & .EntityName & """ was not found!")
End If
' get mapping fragments
Dim MappingFragments As IEnumerable(Of XElement) = _
(From mf In MappingInfo.Descendants(FullElementName("MappingFragment")) _
Select mf)
' make sure there's at least 1 fragment
If IsSequenceEmpty(MappingFragments) Then
Throw New EntityException("Entity """ & .EntityName & """ was not mapped!")
End If
' search each mapping fragment for the desired property
For Each MappingFragment In MappingFragments
' get physical table for this fragment
StoreInfo.TableName = MappingFragment.#StoreEntitySet
' search property expression chain
Dim PropertyMapping As IEnumerable(Of XElement) = {MappingFragment}
' parse complex property info (if any)
For index = 0 To UBound(Properties) - 1
' go down 1 level
Dim ComplexPropertyName = Properties(index)
PropertyMapping = _
(From pm In PropertyMapping.Elements(FullElementName("ComplexProperty")) _
Where pm.#Name = ComplexPropertyName)
' verify that the property specified for this level exists
If IsSequenceEmpty(PropertyMapping) Then
Exit For 'go to next fragment if not
End If
Next index
' property not found? try next fragment
If IsSequenceEmpty(PropertyMapping) Then
Continue For
End If
' parse scalar property info
Dim ScalarPropertyName = Properties(UBound(Properties))
Dim ColumnName As String = _
(From pm In PropertyMapping.Elements(FullElementName("ScalarProperty")) _
Where pm.#Name = ScalarPropertyName _
Select CN = pm.#ColumnName).FirstOrDefault
' verify that scalar property exists
If Not String.IsNullOrEmpty(ColumnName) Then
' yes? return (exit) with column info
StoreInfo.ColumnName = ColumnName : Return StoreInfo
End If
Next MappingFragment
' property wasn't found
Throw New EntityException("Property """ & .PropertyName _
& """ of entity """ & .EntityName & """ was not found!")
End With
End Function
End Class
''' <summary>
''' Conceptual-model entity and property information
''' </summary>
Public Structure MSLConceptualInfo
''' <summary>
''' Name of entity in conceptual model
''' </summary>
''' <value>Entity expression String</value>
''' <remarks>EntityName may or may not be fully qualified (i.e., "ModelName.EntityName");
''' when a mapping method is called by the MSLMappingAction class, the conceptual model's
''' name and a period will be pre-pended if it's omitted</remarks>
Public Property EntityName As String
''' <summary>
''' Name of property in entity
''' </summary>
''' <value>Property expression String</value>
''' <remarks>PropertyName may be either a stand-alone scalar property or a scalar property
''' within 1 or more levels of complex-type properties; in the latter case, it MUST be fully
''' qualified (i.e., "ComplexPropertyName.InnerComplexPropertyName.ScalarPropertyName")</remarks>
Public Property PropertyName As String
End Structure
''' <summary>
''' Database-store table and column information
''' </summary>
Public Structure MSLStoreInfo
''' <summary>
''' Name of table in database
''' </summary>
Public Property TableName As String
''' <summary>
''' Name of column in database table
''' </summary>
Public Property ColumnName As String
End Structure
The catch is that the node names all have to have a namespace prepended to them. It tripped me up until I checked my elements 1 at a time!
Here's the sample XML -- which I load from the ".\SCTModel.msl" file in the code above:
<?xml version="1.0" encoding="utf-8"?>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
<EntityContainerMapping StorageEntityContainer="SCTModelStoreContainer" CdmEntityContainer="SocialContactsTracker">
<EntitySetMapping Name="SocialContacts">
<EntityTypeMapping TypeName="IsTypeOf(SCTModel.SocialContact)">
<MappingFragment StoreEntitySet="SocialContacts">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="DateAdded" ColumnName="DateAdded" />
<ScalarProperty Name="Information" ColumnName="Information" />
<ComplexProperty Name="DefaultAssociations" TypeName="SCTModel.DefaultAssociations">
<ScalarProperty Name="DefaultLocationID" ColumnName="DefaultAssociations_DefaultLocationID" />
<ScalarProperty Name="DefaultEmailID" ColumnName="DefaultAssociations_DefaultEmailID" />
<ScalarProperty Name="DefaultPhoneNumberID" ColumnName="DefaultAssociations_DefaultPhoneNumberID" />
<ScalarProperty Name="DefaultWebsiteID" ColumnName="DefaultAssociations_DefaultWebsiteID" />
</ComplexProperty>
<ScalarProperty Name="Picture" ColumnName="Picture" />
</MappingFragment>
</EntityTypeMapping>
<EntityTypeMapping TypeName="IsTypeOf(SCTModel.Person)">
<MappingFragment StoreEntitySet="SocialContacts_Person">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="DateOfBirth" ColumnName="DateOfBirth" />
<ScalarProperty Name="FirstName" ColumnName="FirstName" />
<ScalarProperty Name="LastName" ColumnName="LastName" />
</MappingFragment>
</EntityTypeMapping>
<EntityTypeMapping TypeName="IsTypeOf(SCTModel.Organization)">
<MappingFragment StoreEntitySet="SocialContacts_Organization">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="DateOfCreation" ColumnName="DateOfCreation" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Locations">
<EntityTypeMapping TypeName="IsTypeOf(SCTModel.Location)">
<MappingFragment StoreEntitySet="Locations">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="City" ColumnName="City" />
<ScalarProperty Name="State" ColumnName="State" />
<ScalarProperty Name="ZIP" ColumnName="ZIP" />
<ScalarProperty Name="Country" ColumnName="Country" />
<ComplexProperty Name="Address" TypeName="SCTModel.Address">
<ScalarProperty Name="Street" ColumnName="Address_Street" />
<ScalarProperty Name="Apartment" ColumnName="Address_Apartment" />
<ScalarProperty Name="HouseNumber" ColumnName="Address_HouseNumber" />
</ComplexProperty>
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="PhoneNumbers">
<EntityTypeMapping TypeName="IsTypeOf(SCTModel.PhoneNumber)">
<MappingFragment StoreEntitySet="PhoneNumbers">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Number" ColumnName="Number" />
<ScalarProperty Name="PhoneType" ColumnName="PhoneType" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Emails">
<EntityTypeMapping TypeName="IsTypeOf(SCTModel.Email)">
<MappingFragment StoreEntitySet="Emails">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="DomainName" ColumnName="DomainName" />
<ScalarProperty Name="UserName" ColumnName="UserName" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Websites">
<EntityTypeMapping TypeName="IsTypeOf(SCTModel.Website)">
<MappingFragment StoreEntitySet="Websites">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="URL" ColumnName="URL" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<AssociationSetMapping Name="SocialContactWebsite" TypeName="SCTModel.SocialContactWebsite" StoreEntitySet="SocialContactWebsite">
<EndProperty Name="SocialContact">
<ScalarProperty Name="Id" ColumnName="SocialContacts_Id" />
</EndProperty>
<EndProperty Name="Website">
<ScalarProperty Name="Id" ColumnName="Websites_Id" />
</EndProperty>
</AssociationSetMapping>
<AssociationSetMapping Name="SocialContactPhoneNumber" TypeName="SCTModel.SocialContactPhoneNumber" StoreEntitySet="SocialContactPhoneNumber">
<EndProperty Name="SocialContact">
<ScalarProperty Name="Id" ColumnName="SocialContacts_Id" />
</EndProperty>
<EndProperty Name="PhoneNumber">
<ScalarProperty Name="Id" ColumnName="PhoneNumbers_Id" />
</EndProperty>
</AssociationSetMapping>
<AssociationSetMapping Name="SocialContactEmail" TypeName="SCTModel.SocialContactEmail" StoreEntitySet="SocialContactEmail">
<EndProperty Name="SocialContact">
<ScalarProperty Name="Id" ColumnName="SocialContacts_Id" />
</EndProperty>
<EndProperty Name="Email">
<ScalarProperty Name="Id" ColumnName="Emails_Id" />
</EndProperty>
</AssociationSetMapping>
<AssociationSetMapping Name="SocialContactLocation" TypeName="SCTModel.SocialContactLocation" StoreEntitySet="SocialContactLocation">
<EndProperty Name="SocialContact">
<ScalarProperty Name="Id" ColumnName="SocialContacts_Id" />
</EndProperty>
<EndProperty Name="Location">
<ScalarProperty Name="Id" ColumnName="Locations_Id" />
</EndProperty>
</AssociationSetMapping>
</EntityContainerMapping>
</Mapping>