Unable to add custom prefix to generated views - codefluent

I want to be able to add the prefix "cf_" to all stored procedures and views. I got it working with stored procedures but the same approach does not work with views. See screen shot for how I assigned custom prefixes.
Although I'm including the XML file, I prefer to use the property pages as opposed to editing the XML directly.
<cf:project defaultNamespace="DemoCustomPrefix" xmlns:cf="http://www.softfluent.com/codefluent/2005/1" xmlns:cfx="http://www.softfluent.com/codefluent/modeler/2008/1" xmlns:cfps="http://www.softfluent.com/codefluent/producers.sqlserver/2005/1" xmlns:cfom="http://www.softfluent.com/codefluent/producers.model/2005/1" xmlns:cfasp="http://www.softfluent.com/codefluent/producers.aspnet/2011/1" defaultTargetFramework="4.0" defaultConnectionString="Database=DemoCustomPrefix;Server=.\SQLExpress;Integrated Security=true" persistenceSaveProcedureFormat="cf_{0}_Save" persistenceLoadProcedureFormat="cf_{0}_{1}" persistenceSearchProcedureFormat="cf_{0}_{1}" persistenceDeleteProcedureFormat="cf_{0}_{1}" persistenceRawProcedureFormat="cf_{0}_{1}" viewFormat="cf_{0}" procedureFormat="cf_{0}" createDefaultMethodForms="true" createDefaultApplication="false" createDefaultHints="false">
<cf:import path="Default.Surface.cfp" />
<cf:producer name="SQL Server Producer" typeName="CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer">
<cf:configuration connectionString="Database=DemoCustomPrefix;Server=.\SQLExpress;Integrated Security=true" produceViews="true" targetVersion="Sql2008" targetDirectory="..\DemoCustomPrefix.Persistence" cfx:targetProjectLayout="UpdateItems, DontRemove" cfx:targetProject="..\DemoCustomPrefix.Persistence\DemoCustomPrefix.Persistence.dbproj" />
</cf:producer>
<cf:producer name="BOM Producer" typeName="CodeFluent.Producers.CodeDom.CodeDomProducer, CodeFluent.Producers.CodeDom, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1bb6d7cccf1045ec">
<cf:configuration compileWithVisualStudio="true" targetDirectory="..\DemoCustomPrefix" cfx:targetProject="..\DemoCustomPrefix\DemoCustomPrefix.csproj" />
</cf:producer>
<cf:producer name="ASP.NET WebForms Producer" typeName="CodeFluent.Producers.UI.AspNetProducer, CodeFluent.Producers.UI">
<cf:configuration categoryPath="UI\AspNetWebForms" targetDirectory="..\DemoCustomPrefix.Web" cfx:targetProject="..\DemoCustomPrefix.Web\DemoCustomPrefix.Web.csproj" />
</cf:producer>
<cf:entity name="Widget" namespace="DemoCustomPrefix">
<cf:property name="Id" key="true" />
<cf:property name="Name" />
</cf:entity>
</cf:project>

Figured it out. Just had to select "Custom Formats" under for Naming Convention.

Related

Office add-in validation fails for IconUrl though it is a 32x32 px image

I have the following line in my manifest
<IconUrl DefaultValue="images/icon-32.png"/>
and also
<Host ...>
...
<Control ...>
....
<Icon>
<bt:Image size="16" DefaultValue="images/icon-16.png"/>
<bt:Image size="32" DefaultValue="images/icon-32.png"/>
<bt:Image size="80" DefaultValue="images/icon-80.png"/>
</Icon>
</Control>
</Host>
But when I submit for approval, I am getting the following error from the Office Store Team.
The icon referenced in the IconUrl element of your add-in manifest must be 32x32 pixels in dimension.
And it is referred to the document Validation Policies point 5.10
I have verified the image to be exactly 32x32 px in size in PNG format. While testing the add-in, the icon-32.png is loaded in the Home menu panel
Update
The complete manifest file is added below
<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp
xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
<Id>aabbccdd-aabbccdd-aabbccdd-aabbccdd</Id>
<Version>1.0</Version>
<ProviderName>TestAddin</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="TestAddin" />
<Description DefaultValue="A Test addin"/>
<IconUrl DefaultValue="https://wireframepro.mockflow.com/integrations/office365/images/icon-32.png" />
<SupportUrl DefaultValue="http://tesaddin.local" />
<AppDomains>
<AppDomain>http://tesaddin.local/</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Document" />
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="http://tesaddin.local/index.html" />
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
<Requirements>
<Sets DefaultMinVersion="1.1">
<Set Name="WordApi" MinVersion="1.1"/>
</Sets>
</Requirements>
<VersionOverrides
xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="Document">
<DesktopFormFactor>
<GetStarted>
<Title resid="ACME.GetStarted.Title"/>
<Description resid="ACME.GetStarted.Description"/>
<LearnMoreUrl resid="ACME.GetStarted.LearnMoreUrl"/>
</GetStarted>
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<OfficeTab id="TabHome">
<Group id="ACME.Group1">
<Label resid="ACME.Group1Label" />
<Icon>
<bt:Image size="16" resid="ACME.tpicon_16x16" />
<bt:Image size="32" resid="ACME.tpicon_32x32" />
<bt:Image size="80" resid="ACME.tpicon_80x80" />
</Icon>
<Control xsi:type="Button" id="ACME.TaskpaneButton">
<Label resid="ACME.TaskpaneButton.Label" />
<Supertip>
<Title resid="ACME.TaskpaneButton.Label" />
<Description resid="ACME.TaskpaneButton.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="ACME.tpicon_16x16" />
<bt:Image size="32" resid="ACME.tpicon_32x32" />
<bt:Image size="80" resid="ACME.tpicon_80x80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<TaskpaneId>ButtonId1</TaskpaneId>
<SourceLocation resid="ACME.Taskpane.Url" />
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="ACME.tpicon_16x16" DefaultValue="https://wireframepro.mockflow.com/integrations/office365/images/icon-16.png" />
<bt:Image id="ACME.tpicon_32x32" DefaultValue="https://wireframepro.mockflow.com/integrations/office365/images/icon-32.png" />
<bt:Image id="ACME.tpicon_80x80" DefaultValue="https://wireframepro.mockflow.com/integrations/office365/images/icon-80.png" />
</bt:Images>
<bt:Urls>
<bt:Url id="ACME.Taskpane.Url" DefaultValue="http://tesaddin.local/index.html" />
<bt:Url id="ACME.GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812" />
</bt:Urls>
<bt:ShortStrings>
<bt:String id="ACME.TaskpaneButton.Label" DefaultValue="Open Editor" />
<bt:String id="ACME.Group1Label" DefaultValue="Test Addin" />
<bt:String id="ACME.GetStarted.Title" DefaultValue="Get started with Test Addin" />
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="ACME.TaskpaneButton.Tooltip" DefaultValue="Open Editor" />
<bt:String id="ACME.GetStarted.Description" DefaultValue="Test add-in has been loaded succesfully. You can access the editor in HOME tab, click Open Editor" />
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
I confirmed the image referenced in your IconUrl is 32x32. Based on what you've posted, I don't see a problem with your image. I suggest re-submitting and mentioning that you couldn't replicate the icon issue from the previous failure.
There are a couple of issue with your manifest that you should address first:
The requirements element should come immediately after your hosts element. While this shouldn't effect the add-in, it is tripping up the automated validation script. Simply moving it after hosts will eliminate this being incorrectly flagged during manifest validation.
You've got a couple of references to http://tesaddin.local/index.html. Add-ins are required to operate over a secure transport (https). The only URIs in your manifest that should use http are the XML schema references. Given the .local, I assume this is just a standing URL for posting on SO so this may not be an issue in your actual manifest.

Pivot Script Producer - Bug Found

I'm sorry to have to submit through this channel.
The report issue feature on your website won't just let me submit my request. Error enclosed:
SoftFluent, SoftFluent, we have a problem! An unidentified error has occured
Problem: Pivot Script producer crashes
Reproductible: Yes
Use case:
Basic use case is having 2 entities named the same (concept is the same but spreaded over different namespace and schema), yet referencing a third entity.
After extending SqlPivotProducer, it appears that referenced table would find its constraints (1 PK and 2 FK) but one of the 2 FK would have a null ReferenceTable leading to nullpointer.
Steps to reproduce:
Have this model below and try to generate Pivot Script File
<cf:project defaultNamespace="Model1" xmlns:cf="http://www.softfluent.com/codefluent/2005/1" xmlns:cfx="http://www.softfluent.com/codefluent/modeler/2008/1" xmlns:cfsps="http://www.softfluent.com/codefluent/producers.sqlpivotscript/2013/1" xmlns:cfps="http://www.softfluent.com/codefluent/producers.sqlserver/2005/1" xmlns:cfspsi="http://www.softfluent.com/codefluent/producers.ixcyssqlpivotscript/2016/1" createDefaultMethodForms="true" createDefaultApplication="false" createDefaultHints="false">
<cf:import path="Default.Surface.cfp" />
<cf:entity name="Entity" schema="SchemaA" namespace="Model1.NamespaceA" persistenceName="Entity">
<cf:property name="EntityId" key="true" />
<cf:property name="EntityC" typeName="{0}.NamespaceC.EntityC" />
</cf:entity>
<cf:entity name="Entity" schema="SchemaB" namespace="Model1.NamespaceB" persistenceName="Entity">
<cf:property name="EntityId" key="true" />
<cf:property name="EntityC" typeName="{0}.NamespaceC.EntityC" />
</cf:entity>
<cf:entity name="EntityC" namespace="Model1.NamespaceC">
<cf:property name="EntityCId" key="true" />
</cf:entity>
<cf:producer name="SQL Server Pivot Script" typeName="CodeFluent.Producers.SqlServer.SqlPivotScriptProducer, CodeFluent.Producers.SqlServer">
<cf:configuration targetDirectory="..\Database1" connectionString="Server=127.0.0.1;Database=EntityA;Integrated Security=true;Application Name=Application;" cfx:targetProject="..\Database1\Database1.sqlproj" cfx:targetProjectLayout="Update" />
</cf:producer>
<cf:producer enabled="false" name="SQL Server" typeName="CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer">
<cf:configuration produceViews="true" targetDirectory="..\Database1" connectionString="Server=127.0.0.1;Database=EntityA;Integrated Security=true;Application Name=FedPeche33_Association;" cfx:targetProject="..\Database1\Database1.sqlproj" cfx:targetProjectLayout="Update, DontRemove" produceSchemas="true" />
</cf:producer>
<cf:producer enabled="false" name="Asp.Net Identity" typeName="CodeFluent.Producers.SqlServer.IxcysSqlPivotScriptProducer, SqlServerPivotIxcys">
<cf:configuration targetDirectory="..\Database1" cfx:targetProject="..\Database1\Database1.sqlproj" cfx:targetProjectLayout="Update" connectionString="Server=127.0.0.1;Database=EntityA;Integrated Security=true;Application Name=FedPeche33_Association;" />
</cf:producer>
</cf:project>
Captured stacktrace:
System.NullReferenceException was unhandled
Message: An unhandled exception of type 'System.NullReferenceException' occurred in CodeFluent.Producers.SqlServer.dll
Additional information: Object reference not set to an instance of an object.
For the time being I would consider renaming my entities to go over this problem.
Thanks for your support
I also had this non-blocking exception on my environment while debugging pivot script generation:
DateTimeInvalidLocalFormat occurred
Message: Managed Debugging Assistant 'DateTimeInvalidLocalFormat' has detected a problem in 'C:\Program Files (x86)\SoftFluent\CodeFluent\Modeler\CodeFluent.Build4.exe'.
Additional information: A UTC DateTime is being converted to text in a format that is only correct for local times. This can happen when calling DateTime.ToString using the 'z' format specifier, which will include a local time zone offset in the output. In that case, either use the 'Z' format specifier, which designates a UTC time, or use the 'o' format string, which is the recommended way to persist a DateTime in text. This can also occur when passing a DateTime to be serialized by XmlConvert or DataSet. If using XmlConvert.ToString, pass in XmlDateTimeSerializationMode.RoundtripKind to serialize correctly. If using DataSet, set the DateTimeMode on the DataColumn object to DataSetDateTime.Utc.

Unable to remove date/time stamps on generated files

I am unable to remove the date/time stamps from the generated files.
The problem is, when I'm editing the .cfp file, I'll set the Production Flags to "Overwrite, RemoveDates". But soon as I save the file, the Production Flags automatically get re-written as "Default, RemoveDates". This happens at both the Producer and Project Level.
If I use the projects advanced properties to set the flags through the GUI, than it sets the Productions Flags to "Default, RemoveDates". Also I don't have the same flag options as in the screenshot at
http://blog.codefluententities.com/2013/04/22/remove-the-current-date-and-time-to-generated-files/
The screenshot has the following checked:
1. Remove Diffs: Remove Dates
2. Remove Dates
None of my options match those in the screenshot. The only one that appears similar is:
Remove Diffs <--- Note that the one in the screen shot has Remove Dates on the same line
Below is the model which was created using version/build 1.0.61214.805 of Codefluent Entities
<cf:project defaultNamespace="DemoRemoveDates" xmlns:cf="http://www.softfluent.com/codefluent/2005/1" xmlns:cfx="http://www.softfluent.com/codefluent/modeler/2008/1" xmlns:cfps="http://www.softfluent.com/codefluent/producers.sqlserver/2005/1" xmlns:cfom="http://www.softfluent.com/codefluent/producers.model/2005/1" xmlns:cfasp="http://www.softfluent.com/codefluent/producers.aspnet/2011/1" defaultConnectionString="Database=DemoRemoveDates;Server=.\SQLExpress;Integrated Security=true" defaultProducerProductionFlags="Default, RemoveDates" createDefaultMethodForms="true" createDefaultApplication="false" createDefaultHints="false">
<cf:import path="Default.Surface.cfp" />
<cf:producer enabled="false" productionFlags="None" name="SQL Server Producer" typeName="CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer">
<cf:configuration connectionString="Database=DemoRemoveDates;Server=.\SQLExpress;Integrated Security=true" produceViews="true" targetVersion="Sql2008" targetDirectory="..\DemoRemoveDates.Persistence" cfx:targetProjectLayout="UpdateItems, DontRemove" cfx:targetProject="..\DemoRemoveDates.Persistence\DemoRemoveDates.Persistence.dbproj" />
</cf:producer>
<cf:producer productionFlags="None" name="BOM Producer" typeName="CodeFluent.Producers.CodeDom.CodeDomProducer, CodeFluent.Producers.CodeDom, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1bb6d7cccf1045ec">
<cf:configuration compileWithVisualStudio="true" targetDirectory="..\DemoRemoveDates" cfx:targetProject="..\DemoRemoveDates\DemoRemoveDates.csproj" cfx:targetProjectLayout="Update" />
</cf:producer>
<cf:producer enabled="false" productionFlags="None" name="ASP.NET WebForms Producer" typeName="CodeFluent.Producers.UI.AspNetProducer, CodeFluent.Producers.UI">
<cf:configuration categoryPath="UI\AspNetWebForms" targetDirectory="..\DemoRemoveDates.Web" cfx:targetProject="..\DemoRemoveDates.Web\DemoRemoveDates.Web.csproj" />
</cf:producer>
<cf:entity name="Contact" namespace="DemoRemoveDates" categoryPath="/DemoRemoveDates">
<cf:property name="Id" key="true" />
<cf:property name="Name" />
</cf:entity>
</cf:project>
This article is pretty old. Try using this value instead:
productionFlags="Default, RemoveDates"
Or use the modeler to set this:
For the BOM producer, you need to set one more flag:
productionFlags="Default, Overwrite, RemoveDates"
You can also define it at model stage:

How do I convince the Visual Studio Publish Web wizard that my database is Entity Framework CodeFirst?

In VS2015 when I open an existing publish profile in the publish wizard, it immediately decides that my default database is no longer EF CodeFirst and removes the option to Execute Code First Migrations and replaces it with Update Database.
Somehow, the wizard seems to be deciding that this is no longer a CodeFirst Project and is replacing it with DbDacFx like so:
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="True">
<Destination Path="Data Source=*" />
<Object Type="DbCodeFirst">
<Source Path="DBMigration" DbContext="m4d.Context.DanceMusicContext, m4d" MigrationConfiguration="m4d.Migrations.Configuration, m4d" Origin="Configuration" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
Transforms to:
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="False">
<Destination Path="Data Source=*" />
<Object Type="DbDacFx">
<PreSource Path="Data Source=*" includeData="False" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
</Object>
<UpdateFrom Type="Web.Config">
<Source MatchValue="Data Source=*" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
</UpdateFrom>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
(I replaced the various connection strings with *)
Anyone have any idea what the wizard uses to decide that this is a CodeFirst Project?
This article http://blogs.msdn.com/b/webdev/archive/2014/04/09/ef-code-first-migrations-deployment-to-an-azure-cloud-service.aspx provides some details of how to roll one's own version of the Execute Code First Migrations option, and is a potential workaround, but it used to just work.
In your .pubxml file, you must rename the ObjectGroup as the full name of your Dbcontext: m4d.Migrations.Configuration. Otherwise, it seems to be ignored.
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="m4d.Migrations.Configuration" Order="1" Enabled="True">
<Destination Path="Data Source=*" />
<Object Type="DbCodeFirst">
<Source Path="DBMigration" DbContext="m4d.Context.DanceMusicContext, m4d" MigrationConfiguration="m4d.Migrations.Configuration, m4d" Origin="Configuration" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>

Entity Framework: 0..1-to-many foreign key constraint not recognized?

I am using EF4 to map a DB schema to an object model; I initially generated the EDMX from the database but have been editing the XML directly (trying to leave the SSDL the same while changing the CSDL/MSL to approximate the object model I want). The database contains, among many other things, a couple tables with a (0..)1-to-many constraint via foreign key like so:
go
create table Options (
KitNodeID int primary key foreign key references KitNodes (KitNodeID),
[SKUID] int null foreign key (SKUID) references SKUs (SKUID)
)
go
create table Upgrades (
UpgradeID int identity (1, 1) primary key not null,
[Name] nvarchar(50) not null,
DefaultOptionID int null references Options (KitNodeID)
)
The relevant sections in the EDMX look like this:
[...]
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="DModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
<EntityContainer Name="DModelStoreContainer">
<AssociationSet Name="FK__Upgrades__Defaul__70DDC3D8" Association="DModel.Store.FK__Upgrades__Defaul__70DDC3D8">
<End Role="Options" EntitySet="Options" />
<End Role="Upgrades" EntitySet="Upgrades" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Upgrades">
<Key>
<PropertyRef Name="UpgradeID" />
</Key>
<Property Name="UpgradeID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="nvarchar" Nullable="false" MaxLength="50" />
<Property Name="DefaultOptionID" Type="int" />
</EntityType>
<Association Name="FK__Upgrades__Defaul__70DDC3D8">
<End Role="Options" Type="DModel.Store.Options" Multiplicity="0..1" />
<End Role="Upgrades" Type="DModel.Store.Upgrades" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Options">
<PropertyRef Name="KitNodeID" />
</Principal>
<Dependent Role="Upgrades">
<PropertyRef Name="DefaultOptionID" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema></edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="DModel" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="DEntities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="Upgrades" EntityType="DModel.Upgrade" />
<AssociationSet Name="Upgrade_DefaultOption" Association="DModel.Upgrade_DefaultOption">
<End Role="Options" EntitySet="Options" />
<End Role="Upgrades" EntitySet="Upgrades" />
</AssociationSet>
</EntityContainer>
<Association Name="Upgrade_DefaultOption">
<End Role="Options" Type="DModel.Option" Multiplicity="0..1" />
<End Role="Upgrades" Type="DModel.Upgrade" Multiplicity="*" />
</Association>
<EntityType Name="Upgrade">
<Key>
<PropertyRef Name="UpgradeID" />
</Key>
<Property Name="UpgradeID" Nullable="false" annotation:StoreGeneratedPattern="Identity" Type="Int32" />
<Property Name="Name" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
<NavigationProperty Name="DefaultOption" Relationship="DModel.Upgrade_DefaultOption" FromRole="Upgrades" ToRole="Options" />
<NavigationProperty Name="OptInOptions" Relationship="DModel.OptInOptions" FromRole="Upgrades" ToRole="Options" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
<EntityContainerMapping StorageEntityContainer="DModelStoreContainer" CdmEntityContainer="DEntities">
<EntitySetMapping Name="Upgrades"><EntityTypeMapping TypeName="DModel.Upgrade"><MappingFragment StoreEntitySet="Upgrades">
<ScalarProperty Name="UpgradeID" ColumnName="UpgradeID" />
<ScalarProperty Name="Name" ColumnName="Name" />
</MappingFragment></EntityTypeMapping></EntitySetMapping>
<AssociationSetMapping Name="Upgrade_DefaultOption" TypeName="DModel.Upgrade_DefaultOption" StoreEntitySet="FK__Upgrades__Defaul__70DDC3D8">
<EndProperty Name="Upgrades">
<ScalarProperty Name="UpgradeID" ColumnName="UpgradeID"/>
</EndProperty>
<EndProperty Name="Options">
<ScalarProperty Name="KitNodeID" ColumnName="DefaultOptionID"/>
</EndProperty>
</AssociationSetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
It will generate code, but when I try to use it I get an "Error 2007: The Table 'FK_Upgrades_Defaul__70DDC3D8' specified as part of this MSL does not exist in MetadataWorkspace." It looks like it can't find the underlying foreign key constraint that the SSDL is supposed to use, but I do see one with that name in the database.
Really, I feel I don't have a very good understanding of how this kind of mapping is supposed to work in general - is a foreign key constraint in the database really treated as an "associationset"? - but this is the closest I can work out. I don't know if anyone could diagnose the problem from the info I've given, but any pointers on where to look? I've tried various things like changing the StoreEntitySet to point to Options, etc. but they just result in different errors.
Try changing how you define your foreign key, see: How do I create a foreign key in SQL Server?
You will probably have to delete and recreate you model.