Exemple #1
0
        public RegisteredComponent AddComponent(Type classType, VueComponentOptions options)
        {
            var componentName = options.Name ?? classType.Name;
            var component     = new RegisteredComponent(classType, options);

            AddComponent(component);
            return(component);
        }
Exemple #2
0
 public CompiledVueModelComponent(
     Type systemType,
     object instance,
     VueComponentOptions componentOptions,
     CSharpTypeHandler typeHandler = null)
 {
     SystemType        = systemType;
     _instance         = instance;
     _componentOptions = componentOptions;
     _typeHandler      = typeHandler;
 }
        public RegisteredComponent(
            Type modelType,
            VueComponentOptions options)
        {
            ModelType = modelType ?? throw new ArgumentNullException(nameof(modelType));
            Options   = options ?? throw new ArgumentNullException(nameof(options));

            if (!ModelType.IsSubclassOf(typeof(VueModel)))
            {
                throw new ArgumentException($"Model inherit from {typeof(VueModel)}", nameof(modelType));
            }
        }
Exemple #4
0
 public RegisteredComponent AddComponent <TVueModel>(VueComponentOptions options = null) where TVueModel : VueModel
 {
     return(AddComponent(typeof(TVueModel), options ?? new VueComponentOptions()));
 }
Exemple #5
0
 public void RegisterComponent <TVueType>(VueComponentOptions componentOptions = null) where TVueType : VueModel
 {
     componentOptions      = componentOptions ?? new VueComponentOptions();
     componentOptions.Name = componentOptions.Name ?? typeof(TVueType).Name;
     Components.Add(new RegisteredComponent(typeof(TVueType), componentOptions));
 }