Database Access

Using or developing a plug-in,
is it possible to generate a class with properties and methods accessing
a database to know what to generate?

thanks!


3 comments

Hello José,

why not? I don't quite understand what is the purpose of using ReSharper's
Open API for that -
it seems the only thing it can help with is formatting of the generated code.


Regards,
Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Using or developing a plug-in,
is it possible to generate a class with properties and methods
accessing
a database to know what to generate?
thanks!



0

Hello,

maybe I didn't understood the real target of the open api for r#, but my
plan was to generate a class using table attributes from a database! Is
this possible? (like codesmith!)

Something like: (


// Generated Code!
public class ClassNameTable
{
public DataTable GetNewDataTable()
{
DataTable dt = new DataTable("dtname");

dt.Columns.Add("column1", typeof(int));
...

return dt;
}

public int? Column1
{
get {return _column1;}
set {_column1 = value;}
} int? _column1;

...
}

thanks!


Dmitry Shaporenkov wrote:

Hello José,

why not? I don't quite understand what is the purpose of using
ReSharper's Open API for that - it seems the only thing it can help with
is formatting of the generated code.


Regards,
Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>> Using or developing a plug-in,
>> is it possible to generate a class with properties and methods
>> accessing
>> a database to know what to generate?
>> thanks!
>>


0

José Cruz wrote:

Hello,

maybe I didn't understood the real target of the open api for r#, but my
plan was to generate a class using table attributes from a database! Is
this possible? (like codesmith!)


I think that is more a job for "System.CodeDom" API of .NET,
I recommend you to read:
Generating and Compiling Source Code Dynamically in Multiple Languages
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconGeneratingCompilingSourceCodeDynamicallyInMultipleLanguages.asp)

Of course... you could create a plugin combining Reshaper with
CodeDom... is that what you want?


Something like: (


// Generated Code!
public class ClassNameTable
{
public DataTable GetNewDataTable()
{
DataTable dt = new DataTable("dtname");

dt.Columns.Add("column1", typeof(int));
...

return dt;
}

public int? Column1
{
get {return _column1;}
set {_column1 = value;}
} int? _column1;

...
}

thanks!


Dmitry Shaporenkov wrote:

>> Hello José,
>>
>> why not? I don't quite understand what is the purpose of using
>> ReSharper's Open API for that - it seems the only thing it can help
>> with is formatting of the generated code.
>>
>>
>> Regards,
>> Dmitry Shaporenkov
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>>
>>> Using or developing a plug-in,
>>> is it possible to generate a class with properties and methods
>>> accessing
>>> a database to know what to generate?
>>> thanks!
>>>

>>
>>

0

Please sign in to leave a comment.