///////////////////////////////////////////////////////////////////////////////// public I2iMarshalObject GetNewObjetForSessionProtected(string strURI, Type typeObjet, int nIdSession) { #if PDA object obj = GetNewObjectProtected(strURI, typeObjet, nIdSession); return((I2iMarshalObject)obj); #else string strRacine = "", strClasse = ""; if (strURI == null) { return(null); } //récupère la racine de l'uri où l'objet se trouve GetRacineEtClasse(GetURIFor(strURI), ref strRacine, ref strClasse); if (m_localFactory != null) { return(m_localFactory.GetNewObject(strClasse, nIdSession)); } //Alloue un allocateur sur le serveur hébergeant l'objet demandé string strFactory = strRacine + "/" + "I2iObjetServeurFactory"; I2iObjetServeurFactory factory = (I2iObjetServeurFactory)Activator.GetObject(typeof(I2iObjetServeurFactory), strFactory); if (factory == null) { return(null); } object obj = factory.GetNewObject(strClasse, nIdSession); return((I2iMarshalObject)obj); #endif }
///////////////////////////////////////////////////////////////////////////////// public static CResultAErreur InitEnLocal( I2iObjetServeurFactory factory, Dictionary <string, MarshalByRefObject> dicLocalSingleton) { m_localFactory = factory; m_localDicSingleton = dicLocalSingleton; m_instance = new C2iFactory(); return(CResultAErreur.True); }
//////////////////////////////////////////////////////////////////////////////////////////////// protected bool TestServeurParDefautProtected() { //Alloue un allocateur sur le serveur string strFactory = m_strDefautUrl + "/" + "I2iObjetServeurFactory"; I2iObjetServeurFactory factory = (I2iObjetServeurFactory)Activator.GetObject(typeof(I2iObjetServeurFactory), strFactory); if (factory == null) { return(false); } try { factory.ToString(); return(true); } catch { } return(false); }