hello
i wanna read a cs file and add a method or region in end of a class .
this operation is located in a visual studio add-in project (extensibility project).
cs file sample:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using Tools.Cmn;
using Common.Cmn;
namespace Life.Cmn
{
[Serializable]
[LocalCache(false)]
[Table(BaseTableName = "lf.Config", TableName = "lf.Config")]
public partial class LifeConfig : CommonConfig
{
public LifeConfig()
{
}
public LifeConfig(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
[Association(OtherKey = "Subject,Name", ThisKey = "Subject,Name")]
public EntityList<LifeConfigHistory> LifeConfigHistoryList
{
get { return GetNavChildList<LifeConfigHistory>("LifeConfigHistoryList"); }
}
}
}
and i want add below code in end of class:
#region UniversalLifePrm
public static T UniversalLifePrm<T>(string configName)
{
return LifeCmn.GetConfigVal("UniversalLifePrm", configName, default(T));
}
#endregion
in finally my class will be this:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using Tools.Cmn;
using Common.Cmn;
namespace Life.Cmn
{
[Serializable]
[LocalCache(false)]
[Table(BaseTableName = "lf.Config", TableName = "lf.Config")]
public partial class LifeConfig : CommonConfig
{
public LifeConfig()
{
}
public LifeConfig(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
[Association(OtherKey = "Subject,Name", ThisKey = "Subject,Name")]
public EntityList<LifeConfigHistory> LifeConfigHistoryList
{
get { return GetNavChildList<LifeConfigHistory>("LifeConfigHistoryList"); }
}
#region UniversalLifePrm
public static T UniversalLifePrm<T>(string configName)
{
return LifeCmn.GetConfigVal("UniversalLifePrm", configName, default(T));
}
#endregion
}
}
please help me.
thanks.
No comments:
Post a Comment