Browse Source

EMD Designer: Several bugfixes concerning wizard/template problems when generating a new EDMX from database

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4716 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Philipp Maihart 16 years ago
parent
commit
16f7f35979
  1. 8
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Templates/Files/CSharp.EDMX.xft
  2. 3
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewResources.xaml
  3. 2
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseObjectBase.cs
  4. 23
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Table.cs
  5. 19
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/View.cs
  6. 1
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/ITable.cs
  7. 1
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IView.cs
  8. 28
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerViewContent.cs
  9. 6
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.xaml.cs
  10. 78
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvas.cs
  11. 9
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/EDMObjects/Designer/Common/UIBusinessType.cs
  12. 35
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/IO/DesignerIO.cs
  13. 28
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/IO/SSDLIO.cs
  14. 2
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/ObjectModelConverters/EDMConverter.cs
  15. 7
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/ObjectModelConverters/SSDLConverter.cs

8
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Templates/Files/CSharp.EDMX.xft

@ -20,7 +20,9 @@ @@ -20,7 +20,9 @@
${Path} -> Full path of the file
-->
<Files>
<File name="${FullName}" language="XML" buildAction="Page"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<!--<File name="${FileNameWithoutExtension}.Designer.cs" language="C#" DependentUpon="${FileName}" SubType="Code"><![CDATA[${StandardHeader.C#}]]></File>-->
<File name="${FullName}" language="XML" buildAction="Page">
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
@ -32,8 +34,8 @@ @@ -32,8 +34,8 @@
<edmx:Mappings />
</edmx:Runtime>
<DesignerViews />
</edmx:Edmx>]]></File>
<File name="${FileNameWithoutExtension}.Designer.cs" language="C#" DependentUpon="${FileName}" SubType="Code"><![CDATA[${StandardHeader.C#}]]></File>
</edmx:Edmx>]]>
</File>
</Files>
<AdditionalOptions/>

3
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewResources.xaml

@ -59,6 +59,9 @@ @@ -59,6 +59,9 @@
<DataTrigger Binding="{Binding ShowCheckBoxes, RelativeSource={RelativeSource AncestorType=TreeView}}" Value="True">
<Setter Property="Visibility" TargetName="chkIsSelected" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding HasKeyDefined}" Value="False">
<Setter Property="IsEnabled" TargetName="chkIsSelected" Value="False" />
</DataTrigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
<DataTemplate x:Key="ColumnDataTemplate">

2
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseObjectBase.cs

@ -39,7 +39,7 @@ namespace ICSharpCode.Data.Core.DatabaseObjects @@ -39,7 +39,7 @@ namespace ICSharpCode.Data.Core.DatabaseObjects
}
}
public bool IsSelected
public virtual bool IsSelected
{
get { return _isSelected; }
set

23
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Table.cs

@ -61,6 +61,29 @@ namespace ICSharpCode.Data.Core.DatabaseObjects @@ -61,6 +61,29 @@ namespace ICSharpCode.Data.Core.DatabaseObjects
get { return string.Format("[{0}].[{1}]", _schemaName, _tableName); }
}
public bool HasKeyDefined
{
get
{
if (Items.FirstOrDefault(column => column.IsPrimaryKey) != null)
return true;
else
return false;
}
}
public override bool IsSelected
{
get
{
if (HasKeyDefined || GetType().GetInterface("IView") != null)
return base.IsSelected;
else
return false;
}
set { base.IsSelected = value; }
}
#endregion
#region IDatabaseObjectBase Members

19
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/View.cs

@ -12,5 +12,24 @@ namespace ICSharpCode.Data.Core.DatabaseObjects @@ -12,5 +12,24 @@ namespace ICSharpCode.Data.Core.DatabaseObjects
{
public class View : Table, IView
{
#region Fields
private string _definingQuery = string.Empty;
#endregion
#region Properties
public string DefiningQuery
{
get { return _definingQuery; }
set
{
_definingQuery = value;
OnPropertyChanged("DefiningQuery");
}
}
#endregion
}
}

1
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/ITable.cs

@ -16,5 +16,6 @@ namespace ICSharpCode.Data.Core.Interfaces @@ -16,5 +16,6 @@ namespace ICSharpCode.Data.Core.Interfaces
string TableName { get; set; }
string SchemaName { get; set; }
DatabaseObjectsCollection<IConstraint> Constraints { get; }
bool HasKeyDefined { get; }
}
}

1
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IView.cs

@ -11,5 +11,6 @@ namespace ICSharpCode.Data.Core.Interfaces @@ -11,5 +11,6 @@ namespace ICSharpCode.Data.Core.Interfaces
{
public interface IView : ITable
{
string DefiningQuery { get; set; }
}
}

28
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerViewContent.cs

@ -94,34 +94,40 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding @@ -94,34 +94,40 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding
{
Debug.Assert(file == this.PrimaryFile);
// Load EDMX from stream
XElement edmxElement = null;
Action<XElement> readMoreAction = edmxElt => edmxElement = edmxElt;
_edmView = new EDMView(stream, readMoreAction);
// If EDMX is empty run EDM Wizard
if (_edmView.EDM.IsEmpty)
{
edmxElement = null;
EDMWizardWindow wizard = RunWizard(file);
if (wizard.DialogResult == true)
{
_edmView = new EDMView(wizard.EDMXDocument, readMoreAction);
//wizard.EDMXDocument.Save("C:\\temp\\test.edmx");
}
edmxElement = null;
EDMWizardWindow wizard = RunWizard(file);
if (wizard.DialogResult == true)
_edmView = new EDMView(wizard.EDMXDocument, readMoreAction);
}
// Load or generate DesignerView and EntityTypeDesigners
EntityTypeDesigner.Init = true;
if (edmxElement.Element("DesignerViews") == null)
edmxElement = new XElement("Designer", DesignerIO.GenerateNewDesignerViewsFromCSDLView(_edmView.CSDL));
if (edmxElement != null && edmxElement.Element("DesignerViews") != null)
DesignerIO.Read(_edmView, edmxElement.Element("DesignerViews"), entityType => new EntityTypeDesigner(entityType), complexType => new ComplexTypeDesigner(complexType));
DesignerIO.Read(_edmView, edmxElement.Element("DesignerViews"), entityType => new EntityTypeDesigner(entityType), complexType => new ComplexTypeDesigner(complexType));
EntityTypeDesigner.Init = false;
//VisualHelper.DoEvents();
// Call DoEvents, otherwise drawing associations can fail
VisualHelper.DoEvents();
// Gets the designer canvas
_designerCanvas = DesignerCanvas.GetDesignerCanvas(this, _edmView, _edmView.DesignerViews.FirstOrDefault());
_scrollViewer.Content = _designerCanvas;
_scrollViewer.Content = _designerCanvas;
// Register CSDL of EDMX in CSDL DatabaseTreeView
CSDLDatabaseTreeViewAdditionalNode.Instance.CSDLViews.Add(_edmView.CSDL);
}

6
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.xaml.cs

@ -16,6 +16,7 @@ using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Property; @@ -16,6 +16,7 @@ using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Property;
using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type;
using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common;
using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations;
using ICSharpCode.Data.Core.UI;
#endregion
@ -197,6 +198,11 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType @@ -197,6 +198,11 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType
internal ListViewItem GetListViewItem(NavigationProperty navigationProperty, out int index)
{
foreach (ListViewItem lvia in VisualTreeHelperUtil.GetControlsDecendant<ListViewItem>(propertiesListView))
{
lvia.ToString();
}
var value = (from lvi in VisualTreeHelperUtil.GetControlsDecendant<ListViewItem>(propertiesListView)
let uiRelatedProperty = lvi.Content as UIRelatedProperty
where uiRelatedProperty != null

78
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvas.cs

@ -71,15 +71,15 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls @@ -71,15 +71,15 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls
var designerView = (DesignerView)e.NewValue;
foreach (TypeBaseDesigner typeBaseDesigner in designerView)
designerCanvas.Children.Add(typeBaseDesigner);
designerCanvas.Loaded +=
delegate
{
VisualHelper.DoEvents();
//designerCanvas.Loaded +=
// delegate
// {
// VisualHelper.DoEvents();
foreach (TypeBaseDesigner typeBaseDesigner in designerView)
typeBaseDesigner.DrawRelations();
designerCanvas.Zoom = designerView.Zoom;
};
// foreach (TypeBaseDesigner typeBaseDesigner in designerView)
// typeBaseDesigner.DrawRelations();
// designerCanvas.Zoom = designerView.Zoom;
// };
}));
private static Dictionary<DesignerView, DesignerCanvas> _designerCanvas = new Dictionary<DesignerView, DesignerCanvas>();
@ -88,18 +88,25 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls @@ -88,18 +88,25 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls
{
DesignerCanvas designerCanvas = null;
if (designerView == null)
{
designerView = new DesignerView();
designerView.ArrangeTypeDesigners = true;
designerView.Name = edmView.Name;
designerView.Zoom = 100;
//if (designerView == null)
//{
// EntityTypeDesigner.Init = true;
foreach(UIEntityType entityType in edmView.CSDL.EntityTypes)
{
designerView.AddTypeDesigner(new EntityTypeDesigner(entityType) { IsExpanded = true });
}
}
// designerView = new DesignerView();
// designerView.ArrangeTypeDesigners = true;
// designerView.Name = edmView.Name;
// designerView.Zoom = 100;
// if (edmView.CSDL.CSDL != null)
// {
// foreach (UIEntityType entityType in edmView.CSDL.EntityTypes)
// {
// designerView.AddTypeDesigner(new EntityTypeDesigner(entityType) { IsExpanded = true });
// }
// }
// EntityTypeDesigner.Init = false;
//}
if (designerView != null && _designerCanvas.ContainsKey(designerView))
{
@ -314,29 +321,38 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls @@ -314,29 +321,38 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls
}
private void DesignerCanvas_Loaded(object sender, RoutedEventArgs e)
{
{
if (DesignerView.ArrangeTypeDesigners)
{
double left = 20, top = 20;
double currentRowsMaxHeight = 0;
EntityTypeDesigner.Init = true;
foreach(EntityTypeDesigner entityTypeDesigner in DesignerView.TypeDesignersLocations)
{
entityTypeDesigner.Left = left;
entityTypeDesigner.Top = top;
entityTypeDesigner.Left = left;
entityTypeDesigner.Top = top;
if (entityTypeDesigner.ActualHeight > currentRowsMaxHeight)
currentRowsMaxHeight = entityTypeDesigner.ActualHeight;
if (entityTypeDesigner.ActualHeight > currentRowsMaxHeight)
currentRowsMaxHeight = entityTypeDesigner.ActualHeight;
left += entityTypeDesigner.ActualWidth + 20;
left += entityTypeDesigner.ActualWidth + 20;
if (left > ActualWidth)
{
top += currentRowsMaxHeight + 20;
left = 20;
}
if (left > ActualWidth)
{
top += currentRowsMaxHeight + 20;
left = 20;
}
}
EntityTypeDesigner.Init = false;
}
foreach (TypeBaseDesigner typeBaseDesigner in DesignerView)
typeBaseDesigner.DrawRelations();
(sender as DesignerCanvas).Zoom = DesignerView.Zoom;
}
protected override void OnPreviewMouseDown(MouseButtonEventArgs e)

9
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/EDMObjects/Designer/Common/UIBusinessType.cs

@ -27,19 +27,12 @@ namespace ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.Common @@ -27,19 +27,12 @@ namespace ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.Common
public BusinessType BusinessInstance { get; private set; }
public virtual string Name
public override string Name
{
get { return BusinessInstance.Name; }
set { BusinessInstance.Name = value; }
}
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
public override string ToString()
{
return Name;

35
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/IO/DesignerIO.cs

@ -7,6 +7,7 @@ using System.Windows; @@ -7,6 +7,7 @@ using System.Windows;
using System.Xml.Linq;
using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer;
using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type;
using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL;
#endregion
@ -26,12 +27,25 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO @@ -26,12 +27,25 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO
public static DesignerView Read(EDMView edmView, Func<UIEntityType, ITypeDesigner> createEntityDesignerFromUIType, Func<UIComplexType, ITypeDesigner> createComplexDesignerFromUIType, XElement designerViewXElement)
{
var designerView = new DesignerView { Name = designerViewXElement.Attribute("Name").Value, Zoom = int.Parse(designerViewXElement.Attribute("Zoom").Value) };
var designerView = new DesignerView()
{
Name = designerViewXElement.Attribute("Name").Value,
Zoom = int.Parse(designerViewXElement.Attribute("Zoom").Value)
};
var arrange = designerViewXElement.Attribute("Arrange");
if (arrange != null)
designerView.ArrangeTypeDesigners = bool.Parse(arrange.Value);
foreach (var designerTypeXElement in designerViewXElement.Elements("DesignerType"))
{
var name = designerTypeXElement.Attribute("Name").Value;
ITypeDesigner typeDesigner;
var entityType = edmView.CSDL.EntityTypes.FirstOrDefault(et => et.Name == name);
if (entityType != null)
typeDesigner = createEntityDesignerFromUIType(entityType);
else
@ -41,13 +55,19 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO @@ -41,13 +55,19 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO
continue;
typeDesigner = createComplexDesignerFromUIType(complexType);
}
var leftAttribute = designerTypeXElement.Attribute("Left").Value;
if (leftAttribute != null)
typeDesigner.Left = double.Parse(leftAttribute, CultureInfo.InvariantCulture);
var topAttribute = designerTypeXElement.Attribute("Top").Value;
if (topAttribute != null)
typeDesigner.Top = double.Parse(topAttribute, CultureInfo.InvariantCulture);
var isExpandedAttribute = designerTypeXElement.Attribute("IsExpanded");
if (isExpandedAttribute != null)
{
RoutedEventHandler loaded = null;
@ -58,9 +78,22 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO @@ -58,9 +78,22 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO
};
typeDesigner.Loaded += loaded;
}
designerView.TypeDesignersLocations.Add(typeDesigner);
}
return designerView;
}
public static XElement GenerateNewDesignerViewsFromCSDLView(CSDLView csdl)
{
XElement designerView = new XElement("DesignerView", new XAttribute("Name", "View"), new XAttribute("Zoom", 100), new XAttribute("Arrange", true));
foreach (UIEntityType entityType in csdl.EntityTypes)
{
designerView.Add(new XElement("DesignerType", new XAttribute("Name", entityType.Name), new XAttribute("Top", 0), new XAttribute("Left", 0), new XAttribute("IsExpanded", true)));
}
return new XElement("DesignerViews", designerView);
}
}
}

28
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/IO/SSDLIO.cs

@ -60,9 +60,17 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO @@ -60,9 +60,17 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO
foreach (Association association in ssdlContainer.AssociationSets)
{
XElement associationSet = new XElement(ssdlNamespace + "AssociationSet",
new XAttribute("Name", association.AssociationSetName), new XAttribute("Association", string.Concat(entityContainerNamespace, association.Name)),
new XAttribute("Name", association.AssociationSetName), new XAttribute("Association", string.Concat(entityContainerNamespace, association.Name)));
string role2Name = association.Role2.Name;
// If the assocation end properties are the same properties
if (association.Role1.Name == association.Role2.Name && association.Role1.Type.Name == association.Role2.Type.Name)
role2Name += "1";
associationSet.Add(
new XElement(ssdlNamespace + "End", new XAttribute("Role", association.Role1.Name), new XAttribute("EntitySet", association.Role1.Type.Name)),
new XElement(ssdlNamespace + "End", new XAttribute("Role", association.Role2.Name), new XAttribute("EntitySet", association.Role2.Type.Name)));
new XElement(ssdlNamespace + "End", new XAttribute("Role", role2Name), new XAttribute("EntitySet", association.Role2.Type.Name)));
entityContainer.Add(associationSet);
}
@ -105,14 +113,26 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO @@ -105,14 +113,26 @@ namespace ICSharpCode.Data.EDMDesigner.Core.IO
foreach (Association association in ssdlContainer.AssociationSets)
{
string role2Name = association.Role2.Name;
// If the assocation end properties are the same properties
if (association.Role1.Name == association.Role2.Name && association.Role1.Type.Name == association.Role2.Type.Name)
role2Name += "1";
XElement associationElement = new XElement(ssdlNamespace + "Association", new XAttribute("Name", association.Name),
new XElement(ssdlNamespace + "End", new XAttribute("Role", association.Role1.Name), new XAttribute("Type", string.Concat(entityContainerNamespace, association.Role1.Type.Name)), new XAttribute("Multiplicity", CardinalityStringConverter.CardinalityToSTring(association.Role1.Cardinality))),
new XElement(ssdlNamespace + "End", new XAttribute("Role", association.Role2.Name), new XAttribute("Type", string.Concat(entityContainerNamespace, association.Role2.Type.Name)), new XAttribute("Multiplicity", CardinalityStringConverter.CardinalityToSTring(association.Role2.Cardinality))));
new XElement(ssdlNamespace + "End", new XAttribute("Role", role2Name), new XAttribute("Type", string.Concat(entityContainerNamespace, association.Role2.Type.Name)), new XAttribute("Multiplicity", CardinalityStringConverter.CardinalityToSTring(association.Role2.Cardinality))));
string dependantRoleName = association.DependantRole.Name;
// If the assocation end properties are the same properties
if (association.PrincipalRole.Name == association.DependantRole.Name && association.PrincipalRole.Type.Name == association.DependantRole.Type.Name)
dependantRoleName += "1";
associationElement.Add(new XElement(ssdlNamespace + "ReferentialConstraint",
new XElement(ssdlNamespace + "Principal", new XAttribute("Role", association.PrincipalRole.Name),
new XElement(ssdlNamespace + "PropertyRef", new XAttribute("Name", association.PrincipalRole.Property.Name))),
new XElement(ssdlNamespace + "Dependent", new XAttribute("Role", association.DependantRole.Name),
new XElement(ssdlNamespace + "Dependent", new XAttribute("Role", dependantRoleName),
new XElement(ssdlNamespace + "PropertyRef", new XAttribute("Name", association.DependantRole.Property.Name)))));
schema.Add(associationElement);

2
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/ObjectModelConverters/EDMConverter.cs

@ -48,8 +48,6 @@ namespace ICSharpCode.Data.EDMDesigner.Core.ObjectModelConverters @@ -48,8 +48,6 @@ namespace ICSharpCode.Data.EDMDesigner.Core.ObjectModelConverters
string edmGenPath = RuntimeEnvironment.GetRuntimeDirectory() + "\\EdmGen.exe";
edmGenPath = @"C:\Windows\Microsoft.NET\Framework\v3.5\EdmGen.exe";
StreamReader streamReader = null;
Process process = new Process();
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.WorkingDirectory = Path.GetTempPath();

7
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/ObjectModelConverters/SSDLConverter.cs

@ -36,7 +36,7 @@ namespace ICSharpCode.Data.EDMDesigner.Core.ObjectModelConverters @@ -36,7 +36,7 @@ namespace ICSharpCode.Data.EDMDesigner.Core.ObjectModelConverters
{
if (!table.IsSelected)
continue;
EntityType entityType = CreateSSDLEntityType(table);
ssdlContainer.EntityTypes.Add(entityType);
@ -79,7 +79,10 @@ namespace ICSharpCode.Data.EDMDesigner.Core.ObjectModelConverters @@ -79,7 +79,10 @@ namespace ICSharpCode.Data.EDMDesigner.Core.ObjectModelConverters
};
if (table is IView)
{
entityType.StoreType = StoreType.Views;
entityType.DefiningQuery = (table as IView).DefiningQuery;
}
else
entityType.StoreType = StoreType.Tables;
@ -175,7 +178,7 @@ namespace ICSharpCode.Data.EDMDesigner.Core.ObjectModelConverters @@ -175,7 +178,7 @@ namespace ICSharpCode.Data.EDMDesigner.Core.ObjectModelConverters
{
Name = constraint.FKTableName,
Cardinality = (Cardinality)constraint.FKCardinality
};
};
Property role2Property = CreateSSDLProperty(constraint.FKColumn, CreateSSDLEntityType(constraint.FKTable));
role2.Property = role2Property;

Loading…
Cancel
Save