I have a property of an object called Contract. It is called client (the GUID of Client in the contract table links to the client in the Client table).
I am trying to manipulate its (the client property of the contract entity) order in the dynamic data grid using the new columnorder attribute in the dynamic data futures. I am also trying to manipulate its filter order using the filter attribute.
I can place the attributes in code, intellisense picks them up, however *no change* happens in the application runtime. (No reordering, like I never placed the attributes, no errors).
Here is my code from the metadata:
namespace ContractsManagement
{
[MetadataType(typeof(ContractsMetaData))]
partial
class
Contracts
{
public Contracts()
{
GUID = Guid.NewGuid();
}
}
partial
class
ContractMetaData
{
[
Filter(Enabled=true, Order=1)]
[ColumnOrder(1)]
public
object Client {
get;
set; }
You probably need public - copy the partial declaration from the data model.
>>GUID = Guid.NewGuid();
I assume the GUID is a PK or other unique identifier. You ctor will run once for every row read. You only need new Guids on insert - and you should arguably generate them on the server, not the client.
Use ScaffoldTable(false) or ScaffoldColumn(false) to verify you have the correct (matching) signature on your partial class.
I can place the attributes in code, intellisense picks them up, however *no change* happens in the application runtime. (No reordering, like I never placed the attributes, no errors).
Hi JKC,
What you are missing is the fact that in the Futures sample the page templates configure an instance of AdvancedFieldGenerator on the GridView and DetailsView. That component is what performs the ordering.
However keep in mind that ColumnOrder and FilterOrder are no longer in the latest bits. You should take a look at the latest
Dynamic Data Preview 2. That build contains a new attribute called DisplayAttribute that combines the concepts covered in the 2 earlier attributes.
Thanks, I took a look and that public didnt solve it, I'll examine the post below and report back.
In regards to the second point, I agree, however, I have newid() as default being generated in SQL, but like post:
http://forums.asp.net/t/1192966.aspx, I continually get the 0000 based guid... I'm not using l2s so I can't define autogeneration... I'm guessing that I just need to set the value of GUID somewhere else and
not in the ctor... and obviously i dont want to much up data model code.
EF uses StoreGeneratedPattern="Computed" in the SSDL - if it's not there add it. All you need is ScaffoldColumn(false) on the GUID and the server will take care of it. 99.9% of the time you don't want to show GUIDs
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An error occurred while updating the entries. See the InnerException for details.
I take it out and it works (adding in the 000 based guid).
In the ctor it works, but obviously this is not the best place for the guid generation...
Thoughts? I added the computed line via intellisence, no typos.
Following that, combing through the forums, I havent seen a working solution yet with DD and EF and GUID generation. I have seen it with L2S. To clarify, Is EF not capable as of yet (in DDp1), is it me, or is it the initial lack DD Preview 2 and DD Preview
2 solves this issue?
Rather than continue to ask questions that most definitely are the result of my lack of understanding (and I apologize, but questions that waste your time of which I've already taken much of) is there a working example of DD and EF with GUID generation
somewhere on the net I could examine (that I have yet to find)?
I'll examine the attribute issue separately, I realize that DDp2 most likely is the requirement and that I likely have DDp1 installed.
JKC
Member
238 Points
266 Posts
Dynamic Data Attribute Trouble.
Feb 17, 2009 04:19 PM|LINK
I have a property of an object called Contract. It is called client (the GUID of Client in the contract table links to the client in the Client table).
I am trying to manipulate its (the client property of the contract entity) order in the dynamic data grid using the new columnorder attribute in the dynamic data futures. I am also trying to manipulate its filter order using the filter attribute.
Both attributes can be seen here, I am using code as is from these examples: http://quickstarts.asp.net/previews/dynamicdata/dd_NewAttributes.htm
I am using EF and dynamic data futures.
I can place the attributes in code, intellisense picks them up, however *no change* happens in the application runtime. (No reordering, like I never placed the attributes, no errors).
Here is my code from the metadata:
namespace ContractsManagement{
[MetadataType(typeof(ContractsMetaData))] partial class Contracts{
public Contracts(){
GUID = Guid.NewGuid();}
}
partial class ContractMetaData{
[
Filter(Enabled=true, Order=1)][ColumnOrder(1)]
public object Client { get; set; }
}
}
Am I missing something?
Dynamic Data
ricka6
All-Star
15070 Points
2272 Posts
Microsoft
Moderator
Re: Dynamic Data Attribute Trouble.
Feb 17, 2009 05:07 PM|LINK
>>partial class ContractsYou probably need public - copy the partial declaration from the data model.>>GUID = Guid.NewGuid();
I assume the GUID is a PK or other unique identifier. You ctor will run once for every row read. You only need new Guids on insert - and you should arguably generate them on the server, not the client.
Use ScaffoldTable(false) or ScaffoldColumn(false) to verify you have the correct (matching) signature on your partial class.
marcind
Contributor
3344 Points
609 Posts
Microsoft
Re: Dynamic Data Attribute Trouble.
Feb 17, 2009 05:59 PM|LINK
Hi JKC,
What you are missing is the fact that in the Futures sample the page templates configure an instance of AdvancedFieldGenerator on the GridView and DetailsView. That component is what performs the ordering.
However keep in mind that ColumnOrder and FilterOrder are no longer in the latest bits. You should take a look at the latest Dynamic Data Preview 2. That build contains a new attribute called DisplayAttribute that combines the concepts covered in the 2 earlier attributes.
ASP.NET Team
@marcind
Blog
JKC
Member
238 Points
266 Posts
Re: Dynamic Data Attribute Trouble.
Feb 17, 2009 08:42 PM|LINK
Thanks, I'll take a look and play around with this... I'll post back when working.
JKC
Member
238 Points
266 Posts
Re: Dynamic Data Attribute Trouble.
Feb 17, 2009 08:51 PM|LINK
Thanks, I took a look and that public didnt solve it, I'll examine the post below and report back.
In regards to the second point, I agree, however, I have newid() as default being generated in SQL, but like post: http://forums.asp.net/t/1192966.aspx, I continually get the 0000 based guid... I'm not using l2s so I can't define autogeneration... I'm guessing that I just need to set the value of GUID somewhere else and not in the ctor... and obviously i dont want to much up data model code.
ricka6
All-Star
15070 Points
2272 Posts
Microsoft
Moderator
Re: Dynamic Data Attribute Trouble.
Feb 17, 2009 09:43 PM|LINK
>>public didnt solve it,
See Marcin's post.
EF uses StoreGeneratedPattern="Computed" in the SSDL - if it's not there add it. All you need is ScaffoldColumn(false) on the GUID and the server will take care of it. 99.9% of the time you don't want to show GUIDs
JKC
Member
238 Points
266 Posts
Re: Dynamic Data Attribute Trouble.
Feb 18, 2009 11:53 AM|LINK
Precisely. Thanks. I'll give it a try and post the results.
JKC
Member
238 Points
266 Posts
Re: Dynamic Data Attribute Trouble.
Feb 18, 2009 02:40 PM|LINK
I add that in an I recieve an exception:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An error occurred while updating the entries. See the InnerException for details.
I take it out and it works (adding in the 000 based guid).
In the ctor it works, but obviously this is not the best place for the guid generation...
Thoughts? I added the computed line via intellisence, no typos.
JKC
Member
238 Points
266 Posts
Re: Dynamic Data Attribute Trouble.
Feb 18, 2009 02:54 PM|LINK
Following that, combing through the forums, I havent seen a working solution yet with DD and EF and GUID generation. I have seen it with L2S. To clarify, Is EF not capable as of yet (in DDp1), is it me, or is it the initial lack DD Preview 2 and DD Preview 2 solves this issue?
Rather than continue to ask questions that most definitely are the result of my lack of understanding (and I apologize, but questions that waste your time of which I've already taken much of) is there a working example of DD and EF with GUID generation somewhere on the net I could examine (that I have yet to find)?
I'll examine the attribute issue separately, I realize that DDp2 most likely is the requirement and that I likely have DDp1 installed.
Thank you for your efforts.
JKC
Member
238 Points
266 Posts
Re: Dynamic Data Attribute Trouble.
Feb 18, 2009 03:42 PM|LINK
Also, I am using the 7/16 release as mentioned on your blog here, would that not have the additional attributes?:
http://blogs.msdn.com/marcinon/