<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET Dynamic Data</title><link>http://forums.asp.net/1145.aspx</link><description>Discussions regarding the new scaffolding framework in ASP.NET</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2071541.aspx</link><pubDate>Thu, 20 Dec 2007 23:44:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071541</guid><dc:creator>marcind</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071541.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2071541</wfw:commentRss><description>&lt;p&gt;I have also placed a zip file with the modified files that you can simply unzip into your Dynamic Data project on &lt;a class="" href="http://blogs.msdn.com/marcinon/archive/2007/12/20/dynamic-data-december-preview-context-caching-bug-fix.aspx"&gt;my blog&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2071191.aspx</link><pubDate>Thu, 20 Dec 2007 20:11:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071191</guid><dc:creator>marcind</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071191.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2071191</wfw:commentRss><description>&lt;p&gt;Thanks Ron,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve updated the fix instructions.&amp;nbsp;I am glad you are finiding Dynamic Data useful.&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2071170.aspx</link><pubDate>Thu, 20 Dec 2007 20:04:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071170</guid><dc:creator>ron.westbrook</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071170.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2071170</wfw:commentRss><description>&lt;p&gt;Yes, awesome, thank you for the fix.&amp;nbsp; One note though, in the FIlterUserControl.ascx, there isn&amp;#39;t a Page_Load function, you are using the Page_Init function instead.&amp;nbsp; I really love the out of the box functionality of dynamic data.&amp;nbsp; It makes the develoment time of data sites so much faster.&amp;nbsp; Even with the customizations I&amp;#39;ve added, it still cut the development time by at least 75%.&amp;nbsp; Thank you guys so much for this set of tools.&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2071132.aspx</link><pubDate>Thu, 20 Dec 2007 19:42:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071132</guid><dc:creator>stevekain</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071132.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2071132</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Excellent Marcin!&amp;nbsp; That did it.&amp;nbsp; Both the filter and edit dropdowns are now updating as expected.&lt;/p&gt;&lt;p&gt;&amp;nbsp;I&amp;#39;m really pretty impressed by the Dynamic Data stuff.&amp;nbsp; It seems like for years different frameworks and controls promised this sort of out of the box functionality but none managed to actually provide it.&lt;/p&gt;&lt;p&gt;&amp;nbsp;From what I&amp;#39;ve seen of Dynamic Data so far it really delivers where previous attempts have failed.&amp;nbsp; I think it really has the potential to get me 40% of my 80% (in the 80-20 rule) in about 10% of the time.&amp;nbsp; Calculate that out and it&amp;#39;s pretty great.&amp;nbsp; Take my word for it.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks again.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2071104.aspx</link><pubDate>Thu, 20 Dec 2007 19:30:51 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071104</guid><dc:creator>marcind</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071104.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2071104</wfw:commentRss><description>&lt;p&gt;Sometimes the most obvious of things ellude us the most. Fortunately, I think we have been able to come up with&amp;nbsp;a working solution to the problem. You will need to edit make changes to 2 files: FilterUserControl.ascx and ForeignKey_Edit.ascx. This solution uses C# (sorry, no VB for now) and should work the same for both inline and code-behind versions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For &lt;strong&gt;ForeignKey_Edit.ascx&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;In the Page_Load method, replace the following line of code&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;DropDownList1.DataSource = parentTable.Query;&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;with this&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;DropDownList1.DataSource = parentTable.DataContextProperty.GetValue(&lt;span style="COLOR:#2b91af;"&gt;Activator&lt;/span&gt;.CreateInstance(&lt;span style="COLOR:#2b91af;"&gt;DynamicDatabase&lt;/span&gt;.TheDatabase.CreateDataContext().GetType()), &lt;span style="COLOR:blue;"&gt;null&lt;/span&gt;);&lt;/pre&gt;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For &lt;strong&gt;FilterUserControl.ascx&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;In the Page_Init method, replace the following line of code&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;DropDownList1.DataSource = DataSource;&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;with this&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;foreignKeyColumn = &lt;span style="COLOR:#2b91af;"&gt;DynamicDatabase&lt;/span&gt;.TheDatabase.GetMetaTable(&lt;span style="COLOR:blue;"&gt;this&lt;/span&gt;.TableName).FindColumn(&lt;span style="COLOR:blue;"&gt;this&lt;/span&gt;.DataField) &lt;span style="COLOR:blue;"&gt;as &lt;/span&gt;&lt;span style="COLOR:#2b91af;"&gt;DynamicMetaForeignKeyMember&lt;/span&gt;;
&lt;span style="COLOR:blue;"&gt;if &lt;/span&gt;(foreignKeyColumn != &lt;span style="COLOR:blue;"&gt;null&lt;/span&gt;) {
    &lt;span style="COLOR:green;"&gt;// only kick in if we are dealing with a foreign key column
    &lt;/span&gt;DropDownList1.DataSource = foreignKeyColumn.ParentMetaTable.DataContextProperty.GetValue(&lt;span style="COLOR:#2b91af;"&gt;Activator&lt;/span&gt;.CreateInstance(&lt;span style="COLOR:#2b91af;"&gt;DynamicDatabase&lt;/span&gt;.TheDatabase.CreateDataContext().GetType()), &lt;span style="COLOR:blue;"&gt;null&lt;/span&gt;);
}
&lt;span style="COLOR:blue;"&gt;else &lt;/span&gt;{
    DropDownList1.DataSource = DataSource;
}&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;The workaround is a bit ugly but it should work. Let us know if you experience more issues. Once we are able to verify that this fix works we will post updated versions of the relevant files.&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2070839.aspx</link><pubDate>Thu, 20 Dec 2007 17:11:05 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2070839</guid><dc:creator>stevekain</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2070839.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2070839</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Honestly I can&amp;#39;t imagine an application that wouldn&amp;#39;t need immediate updating.&amp;nbsp; I suppose if you had a database with no relations, but what real world app has that?&lt;/p&gt;&lt;p&gt;&amp;nbsp;I too have a hard time understanding how this got out the door as part of the preview.&amp;nbsp; It took me 20 minutes of messing around with this thing to find the problem.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2070830.aspx</link><pubDate>Thu, 20 Dec 2007 17:07:05 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2070830</guid><dc:creator>ron.westbrook</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2070830.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2070830</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;stevekain:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; 
&lt;p&gt;&amp;nbsp;Wow.&amp;nbsp; That&amp;#39;s a real disappointment.&amp;nbsp; I sure hope there&amp;#39;s a workaround because this bug is a true dealbreaker for me.&amp;nbsp; And I should think for anyone considering actually using the preview . . .&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;I agree, this is dissapointing and it has brought our testing to a stand still.&amp;nbsp; And if there&amp;#39;s no work around, we are going to have to can it and take another approach.&amp;nbsp; I guess if your application does not require immediate updating, this will be fine, but our application is for cleansing and reconfiguring data, and the records need to be updated across the board at the time they are changed, not when the application feels like re-caching the data.&amp;nbsp; I would have thought this would be on the testing list BEFORE the preview.&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2070803.aspx</link><pubDate>Thu, 20 Dec 2007 16:50:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2070803</guid><dc:creator>stevekain</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2070803.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2070803</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Wow.&amp;nbsp; That&amp;#39;s a real disappointment.&amp;nbsp; I sure hope there&amp;#39;s a workaround because this bug is a true dealbreaker for me.&amp;nbsp; And I should think for anyone considering actually using the preview . . .&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2070240.aspx</link><pubDate>Thu, 20 Dec 2007 11:38:34 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2070240</guid><dc:creator>sandeeppradesh980</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2070240.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2070240</wfw:commentRss><description>&lt;p&gt;same problem here too&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2069415.aspx</link><pubDate>Thu, 20 Dec 2007 02:02:13 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2069415</guid><dc:creator>marcind</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2069415.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2069415</wfw:commentRss><description>&lt;p&gt;The problem you both are seeing is indeed a bug in Dynamic Data caching. I&amp;#39;ll try to see if we can provide some sort of workaround but I&amp;#39;m not sure it&amp;#39;s possible from outside the assembly.&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2068991.aspx</link><pubDate>Wed, 19 Dec 2007 20:44:53 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2068991</guid><dc:creator>ron.westbrook</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2068991.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2068991</wfw:commentRss><description>&lt;p&gt;I am having a very similar issue.&amp;nbsp; When an Update/Insert/Delete is performed on an associated table, the corresponding dropdown is not updated in the next view.&amp;nbsp; I&amp;#39;m thinking that we&amp;#39;re missing an update, load, or databind call somewhere.&amp;nbsp; I am also using the default templates with only one view using minor customization.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2068536.aspx</link><pubDate>Wed, 19 Dec 2007 16:44:52 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2068536</guid><dc:creator>stevekain</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2068536.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2068536</wfw:commentRss><description>&lt;p&gt;I am using the default dynamic data project.&amp;nbsp; I&amp;#39;ve added one or two renderhints but other than that it is standard.&amp;nbsp; I do not have any table-specific pages or controls in action here.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This is the script for the db that is having the problem:&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; ANSI_NULLS &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.objects &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Projects]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; type &lt;span class="sqlkwd3"&gt;in&lt;/span&gt; (N&lt;span class="st"&gt;&amp;#39;U&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;BEGIN
CREATE TABLE&lt;/span&gt; [dbo].[Projects](
	[ProjectID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[ProjectName] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](50) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
 &lt;span class="sqlkwd"&gt;CONSTRAINT&lt;/span&gt; [PK_Projects] &lt;span class="sqlkwd"&gt;PRIMARY KEY CLUSTERED&lt;/span&gt; 
(
	[ProjectID] &lt;span class="sqlkwd"&gt;ASC&lt;/span&gt;
)&lt;span class="sqlkwd"&gt;WITH&lt;/span&gt; (IGNORE_DUP_KEY = &lt;span class="sqlkwd"&gt;OFF&lt;/span&gt;) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
&lt;span class="sqlkwd"&gt;END&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; ANSI_NULLS &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.objects &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Statuses]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; type &lt;span class="sqlkwd3"&gt;in&lt;/span&gt; (N&lt;span class="st"&gt;&amp;#39;U&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;BEGIN
CREATE TABLE&lt;/span&gt; [dbo].[Statuses](
	[StatusID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[StatusName] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](50) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[StatusLevel] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
 &lt;span class="sqlkwd"&gt;CONSTRAINT&lt;/span&gt; [PK_Statuses] &lt;span class="sqlkwd"&gt;PRIMARY KEY CLUSTERED&lt;/span&gt; 
(
	[StatusID] &lt;span class="sqlkwd"&gt;ASC&lt;/span&gt;
)&lt;span class="sqlkwd"&gt;WITH&lt;/span&gt; (IGNORE_DUP_KEY = &lt;span class="sqlkwd"&gt;OFF&lt;/span&gt;) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
&lt;span class="sqlkwd"&gt;END&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; ANSI_NULLS &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.objects &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Priorities]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; type &lt;span class="sqlkwd3"&gt;in&lt;/span&gt; (N&lt;span class="st"&gt;&amp;#39;U&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;BEGIN
CREATE TABLE&lt;/span&gt; [dbo].[Priorities](
	[PriorityID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[PriorityName] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](50) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[PriorityLevel] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
 &lt;span class="sqlkwd"&gt;CONSTRAINT&lt;/span&gt; [PK_Priorities] &lt;span class="sqlkwd"&gt;PRIMARY KEY CLUSTERED&lt;/span&gt; 
(
	[PriorityID] &lt;span class="sqlkwd"&gt;ASC&lt;/span&gt;
)&lt;span class="sqlkwd"&gt;WITH&lt;/span&gt; (IGNORE_DUP_KEY = &lt;span class="sqlkwd"&gt;OFF&lt;/span&gt;) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
&lt;span class="sqlkwd"&gt;END&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; ANSI_NULLS &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.objects &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[SecurityLevels]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; type &lt;span class="sqlkwd3"&gt;in&lt;/span&gt; (N&lt;span class="st"&gt;&amp;#39;U&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;BEGIN
CREATE TABLE&lt;/span&gt; [dbo].[SecurityLevels](
	[SecurityLevelID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[SecurityLevelName] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](50) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[LevelValue] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
 &lt;span class="sqlkwd"&gt;CONSTRAINT&lt;/span&gt; [PK_SecurityLevels] &lt;span class="sqlkwd"&gt;PRIMARY KEY CLUSTERED&lt;/span&gt; 
(
	[SecurityLevelID] &lt;span class="sqlkwd"&gt;ASC&lt;/span&gt;
)&lt;span class="sqlkwd"&gt;WITH&lt;/span&gt; (IGNORE_DUP_KEY = &lt;span class="sqlkwd"&gt;OFF&lt;/span&gt;) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
&lt;span class="sqlkwd"&gt;END&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; ANSI_NULLS &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.objects &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Notes]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; type &lt;span class="sqlkwd3"&gt;in&lt;/span&gt; (N&lt;span class="st"&gt;&amp;#39;U&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;BEGIN
CREATE TABLE&lt;/span&gt; [dbo].[Notes](
	[NoteID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[IssueID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[CreatedByID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[NoteText] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](4000) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
 &lt;span class="sqlkwd"&gt;CONSTRAINT&lt;/span&gt; [PK_Notes] &lt;span class="sqlkwd"&gt;PRIMARY KEY CLUSTERED&lt;/span&gt; 
(
	[NoteID] &lt;span class="sqlkwd"&gt;ASC&lt;/span&gt;
)&lt;span class="sqlkwd"&gt;WITH&lt;/span&gt; (IGNORE_DUP_KEY = &lt;span class="sqlkwd"&gt;OFF&lt;/span&gt;) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
&lt;span class="sqlkwd"&gt;END&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; ANSI_NULLS &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.objects &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Issues]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; type &lt;span class="sqlkwd3"&gt;in&lt;/span&gt; (N&lt;span class="st"&gt;&amp;#39;U&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;BEGIN
CREATE TABLE&lt;/span&gt; [dbo].[Issues](
	[IssueID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[ProjectID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[PriorityID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[StatusID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[CreatedByID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[AssignedToID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NULL&lt;/span&gt;,
	[ResolvedByID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NULL&lt;/span&gt;,
	[IssueTitle] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](50) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[IssueDetails] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](4000) &lt;span class="sqlkwd3"&gt;NULL&lt;/span&gt;,
 &lt;span class="sqlkwd"&gt;CONSTRAINT&lt;/span&gt; [PK_Issues] &lt;span class="sqlkwd"&gt;PRIMARY KEY CLUSTERED&lt;/span&gt; 
(
	[IssueID] &lt;span class="sqlkwd"&gt;ASC&lt;/span&gt;
)&lt;span class="sqlkwd"&gt;WITH&lt;/span&gt; (IGNORE_DUP_KEY = &lt;span class="sqlkwd"&gt;OFF&lt;/span&gt;) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
&lt;span class="sqlkwd"&gt;END&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; ANSI_NULLS &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.objects &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Milestones]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; type &lt;span class="sqlkwd3"&gt;in&lt;/span&gt; (N&lt;span class="st"&gt;&amp;#39;U&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;BEGIN
CREATE TABLE&lt;/span&gt; [dbo].[Milestones](
	[MilestoneID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[ProjectID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[MilestoneName] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](500) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[DueDate] [&lt;span class="sqlkwd"&gt;datetime&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
 &lt;span class="sqlkwd"&gt;CONSTRAINT&lt;/span&gt; [PK_Milestones] &lt;span class="sqlkwd"&gt;PRIMARY KEY CLUSTERED&lt;/span&gt; 
(
	[MilestoneID] &lt;span class="sqlkwd"&gt;ASC&lt;/span&gt;
)&lt;span class="sqlkwd"&gt;WITH&lt;/span&gt; (IGNORE_DUP_KEY = &lt;span class="sqlkwd"&gt;OFF&lt;/span&gt;) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
&lt;span class="sqlkwd"&gt;END&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; ANSI_NULLS &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span class="sqlkwd"&gt;ON&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.objects &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Users]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; type &lt;span class="sqlkwd3"&gt;in&lt;/span&gt; (N&lt;span class="st"&gt;&amp;#39;U&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;BEGIN
CREATE TABLE&lt;/span&gt; [dbo].[Users](
	[UserID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[UserName] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](50) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[Password] [&lt;span class="sqlkwd"&gt;nvarchar&lt;/span&gt;](50) &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
	[SecurityLevelID] [&lt;span class="sqlkwd"&gt;int&lt;/span&gt;] &lt;span class="sqlkwd3"&gt;NOT NULL&lt;/span&gt;,
 &lt;span class="sqlkwd"&gt;CONSTRAINT&lt;/span&gt; [PK_Users] &lt;span class="sqlkwd"&gt;PRIMARY KEY CLUSTERED&lt;/span&gt; 
(
	[UserID] &lt;span class="sqlkwd"&gt;ASC&lt;/span&gt;
)&lt;span class="sqlkwd"&gt;WITH&lt;/span&gt; (IGNORE_DUP_KEY = &lt;span class="sqlkwd"&gt;OFF&lt;/span&gt;) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
) &lt;span class="sqlkwd"&gt;ON&lt;/span&gt; [PRIMARY]
&lt;span class="sqlkwd"&gt;END&lt;/span&gt;
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Notes_Issues]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Notes]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Notes]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Notes_Issues] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([IssueID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[Issues] ([IssueID])
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Notes_Users]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Notes]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Notes]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Notes_Users] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([CreatedByID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[Users] ([UserID])
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Issues_Priorities]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Issues]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Issues]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Issues_Priorities] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([PriorityID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[Priorities] ([PriorityID])
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Issues_Projects]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Issues]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Issues]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Issues_Projects] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([ProjectID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[Projects] ([ProjectID])
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Issues_Statuses]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Issues]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Issues]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Issues_Statuses] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([StatusID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[Statuses] ([StatusID])
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Table5_AssignedUsers]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Issues]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Issues]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Table5_AssignedUsers] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([AssignedToID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[Users] ([UserID])
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Table5_CreateUsers]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Issues]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Issues]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Table5_CreateUsers] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([CreatedByID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[Users] ([UserID])
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Table5_ResolvedUsers]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Issues]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Issues]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Table5_ResolvedUsers] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([ResolvedByID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[Users] ([UserID])
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Milestones_Projects]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Milestones]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Milestones]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Milestones_Projects] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([ProjectID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[Projects] ([ProjectID])
GO
&lt;span class="sqlkwd"&gt;IF&lt;/span&gt; &lt;span class="sqlkwd3"&gt;NOT EXISTS&lt;/span&gt; (&lt;span class="sqlkwd"&gt;SELECT&lt;/span&gt; * &lt;span class="sqlkwd"&gt;FROM&lt;/span&gt; sys.foreign_keys &lt;span class="sqlkwd"&gt;WHERE&lt;/span&gt; &lt;span class="sqlkwd2"&gt;object_id&lt;/span&gt; = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[FK_Users_SecurityLevels]&amp;#39;&lt;/span&gt;) &lt;span class="sqlkwd3"&gt;AND&lt;/span&gt; parent_object_id = &lt;span class="sqlkwd2"&gt;OBJECT_ID&lt;/span&gt;(N&lt;span class="st"&gt;&amp;#39;[dbo].[Users]&amp;#39;&lt;/span&gt;))
&lt;span class="sqlkwd"&gt;ALTER TABLE&lt;/span&gt; [dbo].[Users]  &lt;span class="sqlkwd"&gt;WITH CHECK ADD  CONSTRAINT&lt;/span&gt; [FK_Users_SecurityLevels] &lt;span class="sqlkwd"&gt;FOREIGN KEY&lt;/span&gt;([SecurityLevelID])
&lt;span class="sqlkwd"&gt;REFERENCES&lt;/span&gt; [dbo].[SecurityLevels] ([SecurityLevelID])
&lt;span class="sqlkwd"&gt;ON UPDATE CASCADE
ON DELETE CASCADE&lt;/span&gt;
&lt;/pre&gt;&amp;nbsp;&amp;nbsp;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2067086.aspx</link><pubDate>Wed, 19 Dec 2007 00:34:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2067086</guid><dc:creator>marcind</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2067086.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2067086</wfw:commentRss><description>&lt;p&gt;Hi stevekain,&lt;/p&gt;
&lt;p&gt;There is an issue with how data context caching is done&amp;nbsp;in the Preview version of Dynamic Data that might be the cause of the behavior that you are getting. However, I can&amp;#39;t seem to be able to repro your scenario on my test box (i&amp;#39;m using the Products and Categories tables from Northwind though, but the parent-child pattern should be the same). Are you using the default Dynamic Data project without any customizations? Could you post your DB schema that illustrates the problem?&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2067072.aspx</link><pubDate>Wed, 19 Dec 2007 00:10:54 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2067072</guid><dc:creator>stevekain</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2067072.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2067072</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Well, I&amp;#39;m using the Dynamic Data Extensions so there isn&amp;#39;t really any code that&amp;#39;s specific to the project.&amp;nbsp; I&amp;#39;m not sure whether you picked up on that or not.&lt;/p&gt;&lt;p&gt;&amp;nbsp;If you did then how within the extensions do I repopulate the list?&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Dropdowns not updating correctly</title><link>http://forums.asp.net/thread/2067033.aspx</link><pubDate>Tue, 18 Dec 2007 23:15:41 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2067033</guid><dc:creator>wtroom</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2067033.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2067033</wfw:commentRss><description>&lt;p&gt;Without seeing your code, it may sound like caching as you said, or you may be storing the data for the projects in session.&amp;nbsp; You may need to just recall the data to repopulate the list (which isn&amp;#39;t a big hit). Or if you want to keep it in session your going to need some type of flag to say go and reload the project list because there is a new one in there.&lt;/p&gt;
&lt;p&gt;Feel free to publish your code and maybe we can help futher.&lt;/p&gt;</description></item></channel></rss>