Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. BindingList over Remoting using an interface types

BindingList over Remoting using an interface types

Scheduled Pinned Locked Moved C#
csharpwpfwcfcomsecurity
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MBursill
    wrote on last edited by
    #1

    This works without any problems:

    TcpChannel myChannel = new TcpChannel();

    ChannelServices.RegisterChannel(myChannel, false);

    ICustomer objCustomer = (ICustomer)Activator.GetObject(typeof(ICustomer), "tcp://localhost:8000/Customer.rem");
    BindingList<ICustomer> customers = objCustomer.GetCustomers();

    My form has a binding source which I set the DataSource property to the customers object. The form also has a Binding Navigator which pulls form the BindingSource. If I set the AllowNew property on the customers list to true I get the "+" icon on the BindingNavigator. Exactly what I want. However, when I click that icon it attempts to make a new object of the interface type ICustomer. Obviously not possible. So, I handle the AddingNew event of the list with this:

    void customers_AddingNew(object sender, AddingNewEventArgs e)
    {
    ICustomer newCustomer = (ICustomer)Activator.GetObject(typeof(ICustomer), "tcp://localhost:8000/Customer.rem");

    e.NewObject = newCustomer;
    

    }

    Sadly, that gives me the error: "Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed." I've read up on this err and found that if you change the typeFilterLevel of your remoting formatter it would work. I'd prefer not to do that. Info on that was found here: http://www.thinktecture.com/resourcearchive/net-remoting-faq/changes2003 If they changed this behavior in .Net 2.0 than it was probably for a good reason. There has to be another way to do this? Is it not best practice to code towards interface types? What's the solution for dynamic lists over remoting when using interface types? :confused: -Mike.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups