您好,欢迎访问三七文档
当前位置:首页 > 办公文档 > 其它办公文档 > NET企业服务框架――应用.NET企业服务开发分布式业务觖决方案
StateManagementstate7“”WebServicelllllASP.NETl9290StateCharacteristics9-19-1l——2003112003200311291l——20042005IDl——(affinity)l——l——l——l——l——l——292StatefulorStatelessComponents[JustInTimeActivation]1[AutoComplete][JustInTimeActivation][Transaction]JustInTimeActivation[JustInTimeActivation][Transaction].NETRemoting2.NETRemotingclient-activatedwell-knownll——293l.NETRemotingl[NotSupported]3l322GBlload-balancingDatabasesandFiles294IMDBWindows2000betaIMDBSQLServerIMDBMicrosoftDataEngineMSDESQLServerWindowsCEXMLXMLXMLXMLDOMXPathXQuery.NETSystem.XmlXMLDOMXPathXQuery.NETXML.NET2.0betaSystem.Xml.XQueryW3CXQueryIsolatedStorage9-1IsolatedStorageFileStreamStreamWriterSystem.IO.IsolatedStorageSystem.IOIsolatedStorageFileStreammydata.txtIsolatedStorageFileStreamWriter2959-1staticvoidWriteIsolatedStorageDemo(stringdata)IsolatedStorageFileStreamstream=newIsolatedStorageFileStream(mydata.txt,FileMode.CreateNew);StreamWriterwriter=newStreamWriter(stream);writer.WriteLine(data);writer.Close();stream.Close();}9-2IsolatedStorageFileStreamFileMode.OpenStreamReaderReadLine9-2staticstringReadIsolatedStorageDemo(){IsolatedStorageFileStreamstream=newIsolatedStorageFileStream(mydata.txt,FileMode.Open);StreamReaderreader=newStreamReader(stream);stringdata=reader.ReadLine();reader.Close();stream.Close();returndata;}System.IO.IsolatedStorage9-3IsolatedStorageFileGetUserStoreForDomain2969-3staticstring[]GetFiles(){IsolatedStorageFilestore=IsolatedStorageFile.GetUserStoreForDomain();string[]filenames=store.GetFileNames(*))store.Close();returnfilenames;}ActiveDirectory4llll297llSharedPropertyManagerSharedPropertyManager/SPMSPMSPMCOMSPMCOMVARIANT.NET9-29-2SPM298System.EnterpriseServicesSharedProperty-GroupManagerSharedPropertyGroupSharedPropertySharedPropertyGroupManagerSharedPropertyGroupManager9-1CreatePropertyGroupGroupCreatePropertyGroup9-1SharedPropertyGroupManagerSharedPropertyGroupManagerCreatePropertyGroupCreatePropertyGroupGroupGroupSharedPropertyGroupPropertyLockModePropertyLockModeMethodSetGetSetGetMethod299PropertyReleaseModePropertyReleaseModeStandardProcessStandardProcessStandarddebugreleaseCreatingaSharedPropertyGroupSPMDemoSPM9-4SPMDemoSharedPropertyGroupManager300CreatePropertyGroupPropertyReleaseMode.Process9-4[EventTrackingEnabled]publicclassSPMDemo:ServicedComponent{privateSharedPropertyGroupgroup;publicSPMDemo(){//Createasharedpropertygroup,//orgetareferencetoanexistinggroupboolexisted;PropertyLockModelockMode=PropertyLockMode.SetGet;PropertyReleaseModereleaseMode=PropertyReleaseMode.Process;SharedPropertyGroupManagerspm=newSharedPropertyGroupManager();group=spm.CreatePropertyGroup(SPMDemo,reflockMode,refreleaseMode,outexisted);}GUIDGuidGuid.NewGuidGUID301SharedPropertyGroupCreatePropertyGroupSharedPropertyGroup9-29-2SharedPropertyGroupSharedPropertyGroupCreatePropertyPropertyCreatePropertyPropertyCreatePropertyByPositionPropertyByPositionCreatePropertyPropertySharedPropertySharedPropertyGroupSharedPropertyValue9-5AttendeeInfo9-5AttendeeInfo[Serializable]publicstructAttendeeInfo{publicintCurrentAttendeeCount;publicintMaxAttendees;}9-6SharedPropertyGroupSharedPropertySetAttendeeInfoCreateProperty302SharedPropertyValueAttendeeInfoGetAttendeeInfoPropertyPropertySharedPropertyValueAttendeeInfo9-6publicvoidSetAttendeeInfo(stringcourseNumber,AttendeeInfoattendeeInfo){boolexists;SharedPropertycourseInformation=group.CreateProperty(courseNumber,outexists);courseInformation.Value=attendeeInfo;}publicAttendeeInfoGetAttendeeInfo(stringcourseNumber){SharedPropertycourseInformation=group.Property(courseNumber);return(AttendeeInfo)courseInformation.Value;}ClientApplicationSamples.SPM.SPMDemoSetAttendeeInfoMS-25249-7Samples.SPM.SPMDemo9-7[STAThread]staticvoidMain(string[]args){Samples.SPM.AttendeeInfoinfo;info.MaxAttendees=12;info.CurrentAttendeeCount=8;Samples.SPM.SPMDemoobj1=newSamples.SPM.SPMDemo();303obj1.SetAttendeeInfo(MS-2524,info);obj1.Dispose();Samples.SPM.SPMDemoobj2=newSamples.SPM.SPMDemo();info=obj2.GetAttendeeInfo(MS-2524);Console.WriteLine(MS-2524:Max:{0},Current:{1},info.MaxAttendees,info.CurrentAttendeeCount);obj2.Dispose();}SPMStateCharacteristicsSPMSPMlSPMlSPMlProcessStandardSPMlSPMActivitySPMlSTAVARIANTSPMCOM304ASP.NETStateManagementASP.NET5ASP.NETWebServiceASP.NETASP.NETASP.NETASP.NETlSession——ASP.NETSession205lApplication——CacheApplicationCacheHttpApplicationStatelCache——cacheHttpApplicationState305SessionASP.NETSessionSystem.Web.SessionStateHttpSessionStateWebServicesWebMethodAttributeEnableSession9-8GetCourseMapForAttendeeAttendeeSessionSessionWebServiceWebServiceCourseServiceSessionHttpSessionStateHttpSessionStateSessionCourseMapnullAttendeeControlSessionCourseMapHttpSessionStateobjectSession9-8SessionWebService[WebService(Namespace=)]publicclassCourseService:System.Web.Services.WebService{[WebMethod(EnableSession=true)][return:XmlArray(CourseMap)][return:XmlArrayItem(Course)]publicCourse[]GetCourseMapForAttendee(Attendeeattendee){Course[]courseMap=null;objecto=Sessi
本文标题:NET企业服务框架――应用.NET企业服务开发分布式业务觖决方案
链接地址:https://www.777doc.com/doc-3275301 .html