public override Serializer CreateSyncSerializer()
 {
     Serializer s = new MS_SqlCeSerializer(_DbPath);
     s.RegisterType(typeof(SyncItem));
     s.RegisterType(typeof(FieldState));
     s.Activate();
     return s;
 }
        private void connectMobile()
        {
            int i = 0;
            try
            {
                MobileDB = new MS_SqlCeSerializer(localDivDBPath);
                i++;//1
                MobileDB.RegisterTypes(divMobiTypes);
                i++;
                MobileDB.RegisterType(typeof(UserProfile));
                i++;
                MobileDB.Activate();
                i++;
                //Prüfen ob ein UserProfile zum LoginNamen existiert.
                IList<UserProfile> profiles = new List<UserProfile>();
                i++;//5
                IRestriction r = RestrictionFactory.Eq(typeof(UserProfile), "_LoginName", OptionsAccess.RepositoryOptions.LastUsername);
                //IRestriction r = RestrictionFactory.Eq(typeof(UserProfile), "_LoginName", "TestEditor");
                profiles = MobileDB.Connector.LoadList<UserProfile>(r);
                i++;
                if (profiles.Count > 0)
                {
                    Profile = profiles[0];
                }
                else
                {
                    Profile = createProfile();
                }

                i++;//7

                //mobile Tax Serializer erzeugen
                try
                {
                    MobileTaxa = new MS_SqlCeSerializer(localTaxDBPath);
                    i++;
                    MobileTaxa.RegisterType(typeof(TaxonNames));
                    MobileTaxa.RegisterType(typeof(PropertyNames));
                    i++;//9
                }
                catch
                {
                    MobileTaxa = null;
                }
            }
            catch (Exception mobileDBEx)
            {
                _Log.ErrorFormat("ConnectionError {0} {1}", i, mobileDBEx.Message != null ? mobileDBEx.Message : "");
                MobileDB = null;
                Profile = null;
            }
            finally
            {
                i = 0;
                if (Profile != null)
                {
                    State |= ConnectionState.ProfilePresent;
                    State |= ConnectionState.ConnectedToMobile;
                    i = 10;
                }
                else
                {
                    State &= ~ConnectionState.ProfilePresent;
                    State &= ~ConnectionState.ConnectedToMobile;
                    i = 20;
                }
                if (MobileTaxa != null)
                {
                    State |= ConnectionState.ConnectedToMobileTax;
                    i = i + 100;
                }
                else
                {
                    State &= ~ConnectionState.ConnectedToMobileTax;
                    i = i + 200;
                }
                if (i != 110)
                    _Log.ErrorFormat("Final Result: {0}",i);
            }
        }
 // Stellt eine Verbindung zu einer im Pfad gebenen DB her und Registriert die Typen. Kommt eine Verbindung zu Stande wird True zurückgegeben
 private bool connectDB(String conString,ref Serializer ser, IList<Type> types)
 {
     if (conString == null)
     {
         MessageBox.Show("Select a DB First!", "No DB Selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
     }
     if (File.Exists(@conString) == false)
     {
         MessageBox.Show("File Not Found! Please reselected the DB!", "No DB Selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
     }
     ser = new MS_SqlCeSerializer(conString);
     ser.RegisterTypes(types);
     ser.Activate();
     return true;
 }
        public void connectToMobileDB(DBPaths paths)
        {
            int i = 0;
            try
            {
                MobileDB = new MS_SqlCeSerializer(paths.MobileDB);
                i++;//1
                MobileDB.RegisterTypes(divMobiTypes());
                i++;
                MobileDB.RegisterType(typeof(UserProfile));
                i++;
                MobileDB.Activate();
                i++;

                //mobile Tax Serializer erzeugen
                try
                {
                    MobileTaxa = new MS_SqlCeSerializer(paths.MobileTaxa);

                    i++;
                    MobileTaxa.RegisterType(typeof(TaxonNames));
                    MobileTaxa.RegisterType(typeof(PropertyNames));
                    i++;//9
                }
                catch
                {
                    MobileTaxa = null;
                }
            }
            catch (Exception mobileDBEx)
            {
                _Log.ErrorFormat("ConnectionError {0} {1}", i, mobileDBEx.Message != null ? mobileDBEx.Message : "");
                MobileDB = null;
            }
            finally
            {
                i = 0;
                if (MobileDB != null)
                {
                    State |= ConnectionState.ConnectedToMobile;
                    i = 10;
                }
                else
                {
                    State &= ~ConnectionState.ConnectedToMobile;
                    i = 20;
                }
                if (MobileTaxa != null)
                {
                    State |= ConnectionState.ConnectedToMobileTax;
                    i = i + 100;
                }
                else
                {
                    State &= ~ConnectionState.ConnectedToMobileTax;
                    i = i + 200;
                }
                if (i != 110)
                    _Log.ErrorFormat("Final Result: {0}", i);
            }
        }