Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Feb 18, 2025
1 parent f0d0dd8 commit 3880bd6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions container/register.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package container

import (
"reflect"

"github.com/farseer-go/fs/container/eumLifecycle"
"github.com/farseer-go/fs/exception"
"reflect"
)

// Container 容器操作
Expand All @@ -22,7 +23,7 @@ func Register(constructor any, iocName ...string) {
defContainer.registerConstructor(constructor, name, eumLifecycle.Single)
}

// RegisterTransient 注册实例,默认使用单例
// RegisterTransient 注册实例,临时生命周期
func RegisterTransient(constructor any, iocName ...string) {
if defContainer == nil {
exception.ThrowException("Please call fs.Initialize[Module]() to initialize the module first")
Expand All @@ -31,7 +32,7 @@ func RegisterTransient(constructor any, iocName ...string) {
defContainer.registerConstructor(constructor, name, eumLifecycle.Transient)
}

// RegisterInstance 注册实例,默认使用单例
// RegisterInstance 注册实例,单例
func RegisterInstance[TInterface any](ins TInterface, iocName ...string) {
if defContainer == nil {
exception.ThrowException("Please call fs.Initialize[Module]() to initialize the module first")
Expand Down

0 comments on commit 3880bd6

Please sign in to comment.