internal InstallerScriptableClrMethod(string name, string schemaName, InstallerScriptableSqlAssembly sqlAssembly, Type containedType, MethodInfo method)
 {
     Name = name;
     SchemaName = schemaName;
     ContainedType = containedType;
     Method = method;
     SqlAssembly = sqlAssembly;
 }
 internal InstallerScriptableClrMethod(string name, string schemaName, InstallerScriptableSqlAssembly sqlAssembly, Type containedType, MethodInfo method)
 {
     Name          = name;
     SchemaName    = schemaName;
     ContainedType = containedType;
     Method        = method;
     SqlAssembly   = sqlAssembly;
 }
 internal static InstallerScriptableItem GetScreiptableItem(
     SqlInstallerScriptGeneratorExportedAttributeBase attributeInfo, InstallerScriptableSqlAssembly sqlAssembly,
     MemberInfo declaredItem)
 {
     InstallerScriptableItem item = null;
     if (attributeInfo is SqlInstallerScriptGeneratorExportedFunction && declaredItem is MethodInfo)
     {
         item = new InstallerScriptableSqlFunction(attributeInfo.Name, attributeInfo.SchemaName, sqlAssembly,
             (MethodInfo)declaredItem);
     }
     if (attributeInfo is SqlInstallerScriptGeneratorExportedProcedure && declaredItem is MethodInfo)
     {
         item = new InstallerScriptableSqlProcedure(attributeInfo.Name, attributeInfo.SchemaName, sqlAssembly,
             (MethodInfo)declaredItem);
     }
     if (item == null)
         throw new ArgumentOutOfRangeException(nameof(attributeInfo), "unexpected type of attribute");
     return item;
 }
Esempio n. 4
0
        internal static InstallerScriptableItem GetScreiptableItem(
            SqlInstallerScriptGeneratorExportedAttributeBase attributeInfo, InstallerScriptableSqlAssembly sqlAssembly,
            MemberInfo declaredItem)
        {
            InstallerScriptableItem item = null;

            if (attributeInfo is SqlInstallerScriptGeneratorExportedFunction && declaredItem is MethodInfo)
            {
                item = new InstallerScriptableSqlFunction(attributeInfo.Name, attributeInfo.SchemaName, sqlAssembly,
                                                          (MethodInfo)declaredItem);
            }
            if (attributeInfo is SqlInstallerScriptGeneratorExportedProcedure && declaredItem is MethodInfo)
            {
                item = new InstallerScriptableSqlProcedure(attributeInfo.Name, attributeInfo.SchemaName, sqlAssembly,
                                                           (MethodInfo)declaredItem);
            }
            if (item == null)
            {
                throw new ArgumentOutOfRangeException(nameof(attributeInfo), "unexpected type of attribute");
            }
            return(item);
        }
 public InstallerScriptableSqlProcedure(string name, string schemaName, InstallerScriptableSqlAssembly sqlSqlAssembly, MethodInfo method)
     : base(name, schemaName, sqlSqlAssembly, method.DeclaringType, method)
 {
     _exportedProcedureAttribute = method.GetCustomAttribute<SqlInstallerScriptGeneratorExportedProcedure>();
     _sqlProcedureAttribute = method.GetCustomAttribute<SqlProcedureAttribute>();
 }
Esempio n. 6
0
        private void IterateScriptableItemsInsideAssembly(Assembly asm, Action<InstallerScriptableItem> action)
        {
            var sqlAssembly = new InstallerScriptableSqlAssembly(asm);

            foreach (var method in asm.GetTypes().SelectMany(k => k.GetMembers()).Where(k => k.GetCustomAttributes(false)
                                                                                    .Any(l => l is SqlInstallerScriptGeneratorExportedAttributeBase))
                                                                                    .OrderBy(k => k.Name))
            {
                var attribute = method.GetCustomAttribute<SqlInstallerScriptGeneratorExportedAttributeBase>();
                var scriptableItem = InstallerScriptableItem.GetScreiptableItem(attribute, sqlAssembly, method);
                action(scriptableItem);

            }
        }
Esempio n. 7
0
 public InstallerScriptableSqlProcedure(string name, string schemaName, InstallerScriptableSqlAssembly sqlSqlAssembly, MethodInfo method) : base(name, schemaName, sqlSqlAssembly, method.DeclaringType, method)
 {
     _exportedProcedureAttribute = method.GetCustomAttribute <SqlInstallerScriptGeneratorExportedProcedure>();
     _sqlProcedureAttribute      = method.GetCustomAttribute <SqlProcedureAttribute>();
 }