New Posts New Posts RSS Feed: A DevForce Model Is Not Generated
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

A DevForce Model Is Not Generated

 Post Reply Post Reply
Author
vbivona View Drop Down
Newbie
Newbie


Joined: 12-Jul-2011
Posts: 6
Post Options Post Options   Quote vbivona Quote  Post ReplyReply Direct Link To This Post Topic: A DevForce Model Is Not Generated
    Posted: 12-Jul-2011 at 7:36pm
I'm having a problem getting a DevForce model generated.

I'm using Visual Studio 2010, the DevForce extension appears to be enabled, the application templates are installed and references to DevForce DLL's/assembly are automatically added to my project. However, when I create a model, the .cs designer file doesn't have any of the DevForce classes (it's the standard EF stuff). I also don't see any DevForce properties when I click on an entity in the model designer. (There's no error messages. The key updater says my key is valid.)

Last week I installed the EF June 2011 CTP preview. However, that framework is not targeted in this project. The target for this project is .NET Framework 4. (I selected the DevForce Windows Application template for the project).

Am I supposed to do something else?

Thanks,

Vincent
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 14-Jul-2011 at 10:17am
Hi Vincent,
 
 You mentioned that "the DevForce extension appears to be enabled." Can you confirm that by looking at Tools>>Extension Manager in the VS2010 menu?
 
Silvio.
Back to Top
vbivona View Drop Down
Newbie
Newbie


Joined: 12-Jul-2011
Posts: 6
Post Options Post Options   Quote vbivona Quote  Post ReplyReply Direct Link To This Post Posted: 14-Jul-2011 at 12:18pm
Thanks for your reply.

Yes, it's enabled. The entry is labeled "IdeaBlade OM Designer Extension". The button text says "Disable". When I click on "Disable" the entry changes to "IdeaBlade OM Designer Extension [Disabled]".

Maybe this is an issue:

Before installing DevForce, I installed VS 2010, ADO Entity Framework 4.0, then ADO Entity Framework 4.1, then the June 2011 CTP. However, I used the IdeaBlade application template to create my project and my target frame is set to .NET 4 (I also tried .NET 4 Client Profile).

-------
Before we spend anymore time on this, if you could first help me to see if any of this will matter. I'm trying DevForce because of something that I discovered with the EF. Since DevForce use the EF, I hoping I won't have the same problem:

Basically, the EF writes my model classes with the .NET Property Notification mechanism. Unfortunately, it sends this notifications (i.e. PropertyChanged) when the objects are loading. I want to attach business logic to these objects so that calculations/verifications can be performed when the Application/User actually changes the property value. At first, I assumed I wouldn't get these notifications when my object loads, I thought the EF would just set my instance variables directly and give me back the object it saved. So, it seems to me, that I would need to either disable these notifications during load time, or I have to implement a layer above the EF's model classes.

How does DevForce work? Would I still get property changed notifications during load time? If so, can they be disabled until after the object is loaded? Where do people put their business logic and how do they differentiate between changes made by the persistence layer and the application/user?
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 14-Jul-2011 at 8:16pm
Vincent,

In DevForce PropertyChanged is also triggered when the entities are loaded.

I'm assuming you are setting the PropertyChanged event handler in the entity's constructor. A couple reasons not to do that:

1) Setting the event handler in the constructor will not work in n-tier because serialization does not use the constructor;
2) If you load to many entities, you'd be setting to many event handlers (one for each entity) and that's not very efficient.

I'd suggest you use EntityGroup.EntityPropertyChanged instead:
 
  var eGroup = mgr.GetEntityGroup(typeof(Employee));
  eGroup.EntityPropertyChanged += new EventHandler<EntityPropertyChangedEventArgs>(eGroup_EntityPropertyChanged);
 
=======================================
 
void eGroup_EntityPropertyChanged(object sender, EntityPropertyChangedEventArgs e) {
  if (e.Property.Name == "FirstName") {
    // do something
  }
}
 

Kind regards,
   Silvio.
Back to Top
vbivona View Drop Down
Newbie
Newbie


Joined: 12-Jul-2011
Posts: 6
Post Options Post Options   Quote vbivona Quote  Post ReplyReply Direct Link To This Post Posted: 14-Jul-2011 at 8:22pm
I solved my initial problem. I uninstalled the EntityFramework 4.1 and the June 2011 CTP. Once I did that, DevForce started generating my model classes.

Thanks for your help.
Back to Top
vbivona View Drop Down
Newbie
Newbie


Joined: 12-Jul-2011
Posts: 6
Post Options Post Options   Quote vbivona Quote  Post ReplyReply Direct Link To This Post Posted: 14-Jul-2011 at 8:43pm
Originally posted by sbelini

Vincent,

In DevForce PropertyChanged is also triggered when the entities are loaded.

I'm assuming you are setting the PropertyChanged event handler in the entity's constructor. A couple reasons not to do that:

1) Setting the event handler in the constructor will not work in n-tier because serialization does not use the constructor;
2) If you load to many entities, you'd be setting to many event handlers (one for each entity) and that's not very efficient.

I'd suggest you use EntityGroup.EntityPropertyChanged instead:
 
  var eGroup = mgr.GetEntityGroup(typeof(Employee));
  eGroup.EntityPropertyChanged += new EventHandler<EntityPropertyChangedEventArgs>(eGroup_EntityPropertyChanged);
 
=======================================
 
void eGroup_EntityPropertyChanged(object sender, EntityPropertyChangedEventArgs e) {
  if (e.Property.Name == "FirstName") {
    // do something
  }
}
 

Kind regards,
   Silvio.
In my eariler message (about the property changed notifications) I was talking about the model classes that Microsoft generates, not DevForce. With the standard EF there is no way to disable notifications and that's why I wanted to look at DevForce.

The information you just gave me is very helpful and will definitely enable me to do what I couldn't with Microsoft's implementation. I already tried it and it's great.

Thanks very much,

Vincent
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 15-Jul-2011 at 7:09am
Great, Vincent.
 
Glad I could help.
 
Silvio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down