Skip to content

Help for implementation in a different setup. #17

@git2013vb

Description

@git2013vb

Hi,
I have a specific setup where I'm using Activator.CreateInstance.
Because I have a memory leak I want to try your approach.

But I'm not an expert so I want to ask you help to understand how to do it.

Here my current code
I have an array of class name like this one:

 public static readonly string[] authTables = new string[]
        {
            typeof(User).FullName,
            typeof(UserInfo).FullName
        };

and I give it to my method (in tables):

   public static void CreateTablesInDB(SqliteConnection con, string[] tables)
        {
            foreach (var table in tables)
            {
                Type tableType = Type.GetType(table + ", MyAssemblyName");//* assembly name                
                var instanceTable = Activator.CreateInstance(tableType);
                // here do some stuff with my instanceTable....
                string strCreateTable = ClassToDDL(instanceTable, "create");
            }
        }

User and UserInfo are my classes.

My question is: Can I use your approach? In which way?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions