Dreamine.Hybrid
Dreamine 하이브리드 애플리케이션을 위한 코어 런타임 및 추상화 패키지입니다.
목적
Dreamine.Hybrid는 Host 애플리케이션과 Embedded UI 계층 사이에서 메시지와 상태를 공유하기 위한 플랫폼 중립 계약과 InMemory 구현을 제공합니다.
이 패키지는 WebView2 또는 Blazor를 직접 호스팅하지 않습니다. WPF 전용 호스팅은 Dreamine.Hybrid.Wpf에서 제공합니다.
주요 타입
IHybridMessageIHybridMessageBusIHybridStateStoreHybridMessageBaseInMemoryHybridMessageBusHybridStateStore
앱별 메시지는 이 라이브러리 패키지가 아니라 애플리케이션 또는 샘플 프로젝트에 둡니다. 필요하면 HybridMessageBase를 상속하거나 IHybridMessage를 구현하세요.
패키지 경계
하이브리드 공통 계약 또는 단일 프로세스 내 메시지 버스가 필요할 때 이 패키지를 사용합니다.
WPF에서 BlazorWebView/WebView2를 호스팅하는 HybridHostControl이 필요하면 Dreamine.Hybrid.Wpf를 사용합니다.
라이선스
MIT License
구조 다이어그램
graph TD
subgraph Abstractions
IHybridHost["IHybridHost\n하이브리드 호스트 인터페이스"]
IHybridShell["IHybridShell\n셸 컴포넌트 인터페이스"]
IBlazorBridge["IBlazorBridge\nBlazor ↔ Native 통신"]
DreamineOptions["DreamineOptions\n포트 / 경로 설정"]
end
subgraph Extensions
HybridServiceExtensions["HybridServiceExtensions\nAddDreamineHybrid()"]
HybridHostExtensions["HybridHostExtensions\nRunDreamineApp()"]
end
IHybridHost --> IHybridShell
IHybridHost --> IBlazorBridge
HybridServiceExtensions --> IHybridHost
HybridHostExtensions --> IHybridHostAPI 문서
타입
\if KO 고유 식별자와 생성 시각을 제공하는 하이브리드 메시지 기본 구현입니다. \endif \if EN Provides a hybrid-message base implementation with a unique identifier and creation time. \endif
\if KO 하이브리드 공유 상태 변경 이벤트 데이터를 제공합니다. \endif \if EN Provides event data for hybrid shared-state changes. \endif
\if KO 하이브리드 애플리케이션을 위한 스레드 안전 인메모리 공유 상태 저장소를 제공합니다. \endif \if EN Provides a thread-safe in-memory shared-state store for hybrid applications. \endif
\if KO 하이브리드 애플리케이션 계층 사이에서 교환할 수 있는 메시지를 나타냅니다. \endif \if EN Represents a message that can be exchanged between hybrid application layers. \endif
\if KO 하이브리드 애플리케이션 계층 간 통신용 메시지 버스를 정의합니다. \endif \if EN Defines a message bus for communication between hybrid application layers. \endif
\if KO 개별 메시지 버스 구독자가 발생시킨 예외 처리기를 정의합니다. \endif \if EN Defines a handler for exceptions thrown by individual message-bus subscribers. \endif
\if KO 하이브리드 WPF 및 Blazor 컨텍스트가 공유하는 상태 컨테이너를 정의합니다. \endif \if EN Defines a state container shared by hybrid WPF and Blazor contexts. \endif
\if KO 메시지 형식별 구독자를 스레드 안전하게 관리하는 인메모리 구현입니다. \endif \if EN Provides an in-memory implementation that manages subscribers by message type in a thread-safe manner. \endif
\if KO 의 무동작 Null Object 구현입니다. 별도 처리기를 구성하지 않았을 때 기본값으로 사용됩니다. \endif \if EN Provides a no-op null-object implementation of used when no handler is configured. \endif
\if KO 상태 변경 처리기를 정확히 한 번 제거하는 구독 핸들입니다. \endif \if EN Represents a subscription handle that removes a state-change handler exactly once. \endif
\if KO 메시지 형식과 처리기 및 구독 해제 콜백을 보유하는 구독을 나타냅니다. \endif \if EN Represents a subscription holding its message type, handler, and unsubscribe callback. \endif
\if KO 한 메시지 형식의 구독 컬렉션과 닫힘 상태를 잠금으로 보호합니다. \endif \if EN Lock-protects the subscription collection and closed state for one message type. \endif
HybridMessageBase
\if KO 새 식별자와 현재 시각으로 의 새 인스턴스를 초기화합니다. \endif \if EN Initializes a new instance with a new identifier and the current time. \endif
\if KO 메시지가 생성된 로컬 시각을 가져옵니다. \endif \if EN Gets the local time at which the message was created. \endif
\if KO 고유 메시지 식별자를 가져옵니다. \endif \if EN Gets the unique message identifier. \endif
HybridStateChangedEventArgs`1
\if KO 변경된 상태로 의 새 인스턴스를 초기화합니다. \endif \if EN Initializes a new instance with the changed state. \endif
state— \if KO 구독자에게 전달할 변경된 상태입니다. \endif \if EN The changed state to deliver to subscribers. \endif\if KO 변경된 상태를 가져옵니다. \endif \if EN Gets the changed state. \endif
HybridStateStore`1
\if KO 지정한 초기 상태로 의 새 인스턴스를 초기화합니다. \endif \if EN Initializes a new instance with the specified initial state. \endif
initialState— \if KO 저장소가 처음 보유할 상태입니다. \endif \if EN The state initially held by the store. \endif\if KO 지정한 상태 스냅숏을 포함하여 상태 변경 이벤트를 발생시킵니다. \endif \if EN Raises the state-change event with the specified state snapshot. \endif
state— \if KO 이벤트 구독자에게 전달할 상태입니다. \endif \if EN The state to deliver to event subscribers. \endif\if KO 현재 상태를 교체하고 변경 이벤트를 발생시킵니다. \endif \if EN Replaces the current state and raises the change event. \endif
state— \if KO 저장할 새 상태입니다. \endif \if EN The new state to store. \endif\if KO 상태 변경 처리기를 등록하고 해제 가능한 구독을 반환합니다. \endif \if EN Registers a state-change handler and returns a disposable subscription. \endif
handler— \if KO 등록할 상태 변경 처리기입니다. \endif \if EN The state-change handler to register. \endif반환: \if KO 해제할 때 처리기를 제거하는 구독입니다. \endif \if EN A subscription that removes the handler when disposed. \endif
\if KO 변환 함수를 잠금 안에서 실행하여 상태를 원자적으로 갱신하고 변경 이벤트를 발생시킵니다. \endif \if EN Atomically updates the state by invoking a transformation under the lock, then raises the change event. \endif
updater— \if KO 현재 상태를 새 상태로 변환하는 함수입니다. \endif \if EN The function that transforms the current state into a new state. \endif\if KO 잠금으로 보호된 현재 상태 스냅숏을 가져옵니다. \endif \if EN Gets a lock-protected snapshot of the current state. \endif
\if KO state 값을 보관합니다. \endif \if EN Stores the state value. \endif
\if KO sync Root 값을 보관합니다. \endif \if EN Stores the sync root value. \endif
\if KO 저장된 상태가 변경되었을 때 발생합니다. \endif \if EN Occurs when the stored state changes. \endif
IHybridMessage
\if KO 메시지가 생성된 시각을 가져옵니다. \endif \if EN Gets the time when the message was created. \endif
\if KO 고유 메시지 식별자를 가져옵니다. \endif \if EN Gets the unique message identifier. \endif
IHybridMessageBus
\if KO 지정한 메시지를 등록된 구독자에게 비동기적으로 게시합니다. \endif \if EN Asynchronously publishes the specified message to registered subscribers. \endif
message— \if KO 게시할 메시지 인스턴스입니다. \endif \if EN The message instance to publish. \endifcancellationToken— \if KO 게시 작업 취소 토큰입니다. \endif \if EN A token used to cancel publishing. \endif반환: \if KO 비동기 게시 작업입니다. \endif \if EN A task representing the asynchronous publish operation. \endif
\if KO 지정한 메시지 형식에 처리기를 구독시킵니다. \endif \if EN Subscribes a handler to the specified message type. \endif
handler— \if KO 메시지를 비동기적으로 처리할 대리자입니다. \endif \if EN The delegate that asynchronously handles messages. \endif반환: \if KO 해제할 때 구독을 제거하는 핸들입니다. \endif \if EN A handle that removes the subscription when disposed. \endif
IHybridMessageBusExceptionHandler
\if KO 구독자 처리기가 처리되지 않은 예외를 발생시켰을 때 호출됩니다. \endif \if EN Called when a subscriber handler throws an unhandled exception. \endif
exception— \if KO 구독자가 발생시킨 예외입니다. \endif \if EN The exception thrown by the subscriber. \endifmessageType— \if KO 게시 중이던 메시지 형식입니다. \endif \if EN The type of message being published. \endifIHybridStateStore`1
\if KO 현재 상태를 지정한 값으로 교체합니다. \endif \if EN Replaces the current state with the specified value. \endif
state— \if KO 저장할 새 상태입니다. \endif \if EN The new state to store. \endif\if KO 상태 변경 처리기를 구독하고 해제 가능한 구독 핸들을 반환합니다. \endif \if EN Subscribes a state-change handler and returns a disposable subscription handle. \endif
handler— \if KO 등록할 상태 변경 처리기입니다. \endif \if EN The state-change handler to register. \endif반환: \if KO 해제할 때 처리기를 제거하는 구독입니다. \endif \if EN A subscription that removes the handler when disposed. \endif
\if KO 지정한 변환 함수를 사용하여 현재 상태를 원자적으로 갱신합니다. \endif \if EN Atomically updates the current state using the specified transformation function. \endif
updater— \if KO 현재 상태를 새 상태로 변환하는 함수입니다. \endif \if EN A function that transforms the current state into a new state. \endif\if KO 현재 상태의 스레드 안전 스냅숏을 가져옵니다. \endif \if EN Gets a thread-safe snapshot of the current state. \endif
\if KO 저장된 상태가 변경되었을 때 발생합니다. \endif \if EN Occurs when the stored state changes. \endif
InMemoryHybridMessageBus
\if KO 현재 스냅숏에 포함된 구독자에게 메시지를 순서대로 비동기 게시하며 개별 구독자 실패를 격리합니다. \endif \if EN Asynchronously publishes a message sequentially to the current subscriber snapshot while isolating individual subscriber failures. \endif
message— \if KO 게시할 메시지입니다. \endif \if EN The message to publish. \endifcancellationToken— \if KO 남은 전달을 중단하는 취소 토큰입니다. \endif \if EN A token that stops remaining deliveries. \endif반환: \if KO 현재 구독자에게 전달하는 작업입니다. \endif \if EN A task representing delivery to the current subscribers. \endif
\if KO 지정한 메시지 형식의 비동기 처리기를 등록합니다. \endif \if EN Registers an asynchronous handler for the specified message type. \endif
handler— \if KO 메시지 처리 대리자입니다. \endif \if EN The message-handling delegate. \endif반환: \if KO 해제 시 처리기를 제거하는 구독입니다. \endif \if EN A subscription that removes the handler when disposed. \endif
\if KO 지정한 구독을 메시지 형식 버킷에서 제거하고 빈 버킷을 닫습니다. \endif \if EN Removes the specified subscription from its message-type bucket and closes an empty bucket. \endif
subscription— \if KO 제거할 구독입니다. \endif \if EN The subscription to remove. \endif\if KO 구독자가 예기치 않은 예외를 발생시켰을 때 호출할 처리기를 가져오거나 설정합니다. 기본값은 무동작 입니다. \endif \if EN Gets or sets the handler invoked when a subscriber throws an unexpected exception. The default is the no-op . \endif
\if KO exception Handler 값을 보관합니다. \endif \if EN Stores the exception handler value. \endif
\if KO subscriptions 값을 보관합니다. \endif \if EN Stores the subscriptions value. \endif
NullHybridMessageBusExceptionHandler
\if KO 외부 인스턴스 생성을 막고 싱글턴 사용을 강제합니다. \endif \if EN Prevents external construction and enforces use of the singleton. \endif
\if KO 구독자 예외를 의도적으로 무시합니다. \endif \if EN Intentionally ignores a subscriber exception. \endif
exception— \if KO 무시할 구독자 예외입니다. \endif \if EN The subscriber exception to ignore. \endifmessageType— \if KO 게시 중이던 메시지 형식입니다. \endif \if EN The type of message being published. \endif\if KO 공유 싱글턴 인스턴스를 가져옵니다. \endif \if EN Gets the shared singleton instance. \endif
StateSubscription
\if KO 대상 저장소와 처리기로 새 구독 핸들을 초기화합니다. \endif \if EN Initializes a new subscription handle for the target store and handler. \endif
store— \if KO 처리기가 등록된 저장소입니다. \endif \if EN The store on which the handler is registered. \endifhandler— \if KO 해제할 상태 변경 처리기입니다. \endif \if EN The state-change handler to remove. \endif\if KO 등록된 처리기를 스레드 안전하게 한 번만 제거합니다. \endif \if EN Thread-safely removes the registered handler at most once. \endif
\if KO handler 값을 보관합니다. \endif \if EN Stores the handler value. \endif
\if KO store 값을 보관합니다. \endif \if EN Stores the store value. \endif
Subscription
\if KO 메시지 형식, 처리기 및 구독 해제 콜백으로 새 구독을 초기화합니다. \endif \if EN Initializes a new subscription with its message type, handler, and unsubscribe callback. \endif
messageType— \if KO 구독한 메시지 형식입니다. \endif \if EN The subscribed message type. \endifhandler— \if KO 메시지 처리기 객체입니다. \endif \if EN The message-handler object. \endifunsubscribe— \if KO 해제 시 호출할 콜백입니다. \endif \if EN The callback invoked during disposal. \endif\if KO 구독을 한 번만 해제하고 소유 버스에서 제거합니다. \endif \if EN Disposes the subscription at most once and removes it from the owning bus. \endif
\if KO 메시지 처리기 객체를 가져옵니다. \endif \if EN Gets the message-handler object. \endif
\if KO 이 구독이 해제되었는지 여부를 가져옵니다. \endif \if EN Gets whether this subscription has been disposed. \endif
\if KO 구독한 메시지 형식을 가져옵니다. \endif \if EN Gets the subscribed message type. \endif
\if KO disposed 값을 보관합니다. \endif \if EN Stores the disposed value. \endif
\if KO unsubscribe 값을 보관합니다. \endif \if EN Stores the unsubscribe value. \endif
SubscriptionBucket
\if KO 현재 구독 배열의 스레드 안전 스냅숏을 만듭니다. \endif \if EN Creates a thread-safe snapshot of the current subscription array. \endif
반환: \if KO 현재 구독의 복사본입니다. \endif \if EN A copy of the current subscriptions. \endif
\if KO 버킷에서 지정한 구독을 제거합니다. \endif \if EN Removes the specified subscription from the bucket. \endif
subscription— \if KO 제거할 구독입니다. \endif \if EN The subscription to remove. \endif\if KO 버킷이 열려 있으면 구독을 추가합니다. \endif \if EN Adds a subscription when the bucket is open. \endif
subscription— \if KO 추가할 구독입니다. \endif \if EN The subscription to add. \endif반환: \if KO 추가했으면 , 버킷이 닫혔으면 입니다. \endif \if EN when added; when the bucket is closed. \endif
\if KO 구독이 없으면 버킷을 닫아 더 이상 추가되지 않게 합니다. \endif \if EN Closes the bucket when it has no subscriptions, preventing further additions. \endif
반환: \if KO 빈 버킷을 닫았으면 , 아직 구독이 있으면 입니다. \endif \if EN when the empty bucket was closed; when subscriptions remain. \endif
\if KO closed 값을 보관합니다. \endif \if EN Stores the closed value. \endif
\if KO subscriptions 값을 보관합니다. \endif \if EN Stores the subscriptions value. \endif