WPF browser Application with DataObjects.Net 4.3RC

//WPF browser Application with DataObjects.Net 4.3RC

WPF browser Application with DataObjects.Net 4.3RC

Today started a new challenge. I’m going to write an WPF Browser Application called the ‘AnyMatrix’ (small hint to what my movie taste is). The first results are encouraging. (http://ormmatrix.sinnema.ch). A TabControl and a button (that does nothing yet) is visible (will change in the near future). I’m going to use DataObjects.Net 4.3RC as my Data Access Layer. So it’s going to be a test for that too.

What I aim at is a website on which I can host any comparison matrix (like the cmsmatrix). The first Matrix is going to be the ORM Matrix.

Here I’ll describe the struggles I’ve encountered so far. Here’s the first one:

Created a WPF Browser Project and simply started it. Wow, that is nice. Out of the box it just works locally. WPF is a huge step forward. Wonder if the Application I build will work out-of-the-browser too. Guess that should be possible.

Added a TabControl a few TabItems and a button. Works fine too.

Now for the Deployment. Would like to see if my provider (http://www.simplehosting.ch) supports this kind of applications.

MIME Types

Had to add some MIME Types to the configuration. Plesk does a good job at that. Here’s a link on what to configure: http://msdn.microsoft.com/en-us/library/ms752346.aspx.

Added a HTML main page like so:

<html> 
  <head></head> 
    <frameset cols="100%,100%"> 
      <frame src="AnyMatrix.xbap" > 
  </frameset> 
</html>

Copied the needed files to the Web Server. Here’s a link on what to copy: http://msdn.microsoft.com/en-us/library/aa970060.aspx

Called my link: http://ormmatrix.sinnema.ch and voila, the page is there, impressive.

Just discovered it does not work in Chromium (not Chrome).

Dataobjects.Net 4

Now I’ll try and get DO4 to work. Added a DO4 Project to my solution. After writing some code to initialize the Domain got an exception I don’t fully can grasp. It is thrown in the Getter of the Domain where the .Build() is called.

Inheritance security rules violated while overriding member:

‘Xtensive.Storage.Entity.System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)’. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Here^s my Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xtensive.Storage.Configuration;
using Xtensive.Storage;

namespace AnyMatrixModel
{
    public class DomainManager
    {
        private static DomainConfiguration m_DomainConfiguration;
        private static Domain m_Domain;
        private static Session m_Session;

        public static DomainConfiguration DomainConfiguration
        {
            get
            {
                if (m_DomainConfiguration == null)
                {
                    m_DomainConfiguration = new DomainConfiguration("sqlserver", "Data Source=DIARTIS-SQL1\\SQL2008;Initial Catalog=ORMMatrix;Persist Security Info=True;User ID=xxxxxxxxx;Password=xxxxxxxxxx;MultipleActiveResultSets=True");

                    m_DomainConfiguration.Types.Register(System.Reflection.Assembly.GetExecutingAssembly(), typeof(Person).Namespace);
                }

                return m_DomainConfiguration;
            }
        }

        public static Domain Domain
        {
            get
            {
                if(m_Domain == null)
                {
                    try
                    {
                        m_Domain = Domain.Build(DomainManager.DomainConfiguration);
                    }
                    catch (Exception x)
                    {

                        throw;
                    }
                }

                return m_Domain;
            }
        }

        public static Session Session
        {
            get
            {
                if(m_Session == null)
                {
                    m_Session = Session.Open(DomainManager.Domain);

                    DisconnectedState disconnectedState = new DisconnectedState();

                    disconnectedState.Attach(m_Session);
                }

                return m_Session;
            }
        }
    }
}

Running the application in ‘Full Trust’, as suggested by X-Tensive (see here) solved the exception, but then I got the next one.

No upgrade handler is found for assembly ‘OrmMatrix’, version ‘1.0.0.0’.

After changing the above getter for the DomainConfiguration and the App.config like so:

        public static DomainConfiguration DomainConfiguration
        {
            get
            {
                if (m_DomainConfiguration == null)
                {
                    m_DomainConfiguration = DomainConfiguration.Load("Default");
                }

                return m_DomainConfiguration;
            }
        }
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="Xtensive.Storage" type="Xtensive.Storage.Configuration.Elements.ConfigurationSection, Xtensive.Storage" />
  </configSections>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>

  <Xtensive.Storage>
    <domains>
      <domain name="Default"
              provider="sqlserver"
              upgradeMode="Recreate"
              connectionString="Data Source=DIARTIS-SQL1\SQL2008;Initial Catalog=ORMMatrix;Persist Security Info=True;User ID=xxxxxxxxxx;Password=xxxxxxxxxx;MultipleActiveResultSets=True" >
        <types>
          <add assembly="AnyMatrixModel" />
        </types>
      </domain>
    </domains>
  </Xtensive.Storage>
</configuration>

The Application started running as expected (locally).

By |2011-04-23T11:42:47+00:00March 12th, 2011|.Net Development|0 Comments

About the Author:

Leave A Comment