New Posts New Posts RSS Feed: ModelExplorer - SL4
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

ModelExplorer - SL4

 Post Reply Post Reply
Author
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Topic: ModelExplorer - SL4
    Posted: 09-Jun-2010 at 8:28am
Instead of DynamicTypeInfo(aType) try DynamicTypeInfo.GetTypeInfo(Type type)

I find sometimes it's helpful to use Reflector when you get stuck. You can see that the constructor is now internal, so in Reflector you can right click it and go to Analyze, and see that it's called by DynamicTypeInfo.GetTypeInfo(), which seems to cache to improve performance


Edited by smi-mark - 09-Jun-2010 at 8:31am
Back to Top
bigfish View Drop Down
Newbie
Newbie


Joined: 20-Mar-2009
Location: Australia
Posts: 36
Post Options Post Options   Quote bigfish Quote  Post ReplyReply Direct Link To This Post Posted: 09-Jun-2010 at 5:29am
Thanks, that got me over that hurdle.  There has been quite of lot of changes, like this one below too.
 

public static Type GetUltimateType(Type aType) {

if (null == aType)

return null;

// Get DynamicType conversion if Anonymous Type

return AnonymousFns.IsAnonymousType(aType) ? new DynamicTypeInfo(aType).DynamicType : aType;

}

DynamicTypeInfo no longer takes 1 argument in the constructor, but appears to be a more strongly typed constructor...

public DynamicTypeInfo(string typeName, IEnumerable<string> propertyNames, IEnumerable<Type> propertyTypes);

Any suggestions for a replacement please? I'm finding it hard to do the translation or even delve into the old Ideablade binaries...
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 08-Jun-2010 at 9:02am
The problem is, it is no longer a EntityQueriedEventArgs.

this.EntityManager.ExecuteQueryAsync(query, delegate (EntityQueryOperation args) {
                this.QueryCallback(args, callback);
            }, null);

private void QueryCallback(EntityQueryOperation args, Action<IEnumerable> callback)
        {
           
        }
Back to Top
bigfish View Drop Down
Newbie
Newbie


Joined: 20-Mar-2009
Location: Australia
Posts: 36
Post Options Post Options   Quote bigfish Quote  Post ReplyReply Direct Link To This Post Posted: 08-Jun-2010 at 3:37am
Ouch, line numbers went astray on post - sorry!
Back to Top
bigfish View Drop Down
Newbie
Newbie


Joined: 20-Mar-2009
Location: Australia
Posts: 36
Post Options Post Options   Quote bigfish Quote  Post ReplyReply Direct Link To This Post Posted: 08-Jun-2010 at 3:36am
The SL3 version of ModelExplorer included a sample Repository.cs
 
SL4 versions of DFSL break this on line 10 in RED after lines 16 and 17 were changed to reflect DFSL4 breaking changes doco.
 
Error is:  The best overloaded method match for 'Infrastructure.Repository.QueryCallback(IdeaBlade.EntityModel.EntityQueriedEventArgs, System.Action<System.Collections.IEnumerable>)' has some invalid arguments.
Can you please give me a pointer as to what I could adjust here in my quest to move ModelExplorer to SL4.
  1. protected void Query(IEntityQuery query, Action<IEnumerable> callback) {
  2. if (null == query) {
  3. QueryCallbackImpl(null, new List<object>() , callback );
  4. return;
  5. }
  6. EntityManager.DefaultQueryStrategy = QueryStrategy.Normal;
  7. try {
  8. EntityManager.ExecuteQueryAsync(
  9. query,
  10. args => QueryCallback(args, callback),
  11. null);
  12. } catch (Exception e) {
  13. QueryExceptionHandler(e, callback);
  14. }
  15. }
  16. private void QueryCallback(EntityQueriedEventArgs args, Action<IEnumerable> callback) {
  17. QueryCallbackImpl(args.Error, args.Results, callback);
  18. }
  19. private void QueryCallbackImpl(Exception e, IEnumerable result, Action<IEnumerable> callback) {
  20. EntityManager.DefaultQueryStrategy = QueryStrategy.CacheOnly;
  21. if (null != e) {
  22. ReportError(e);
  23. }
  24. callback(result);
  25. }
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down