Sub Sonic - 1.0
Extension ID
com.castsoftware.dotnet.subsonic
What’s new?
Please see SubSonic - 1.0 - Release Notes for more information.
Description
This extension provides support for the SubSonic framework for .NET.
In what situation should you install this extension?
This extension should be installed when analyzing a .NET project that uses SubSonic framework, and you want to view CRUD transactions of the SubSonic objects. Links to corresponding SQL database tables can also be resolved, provided that the SQL database has been extracted and DDL has been created.
Technology support
The following libraries are supported by this extension:
Language | Library name | Namespace | Version | Supported |
---|---|---|---|---|
.NET | SubSonic | SubSonic | 4.1.0 to 4.3.0 | ✔️ |
Compatibility
This extension is compatible with:
CAST Imaging Core release | Supported |
---|---|
8.3.x | ✔️ |
Download and installation instructions
For applications using any of the above mentionned libraries, this extension will be automatically installed by CAST Imaging Console. For upgrade, if the Extension Strategy is not set to Auto update, you can manually upgrade the extension using the Application - Extensions interface.
What results can you expect?
Once the analysis/snapshot generation has completed, you can view the below objects and links created.
Objects
Icon | Description | Comment |
---|---|---|
SubSonic Entity | An object is created for each Subsonic Persistent Object | |
SubSonic Entity Operation | An object is created for each Subsonic Persistent Object CRUD operation | |
SubSonic Unknown Entity | An object is created for when Subsonic Persistent Object cannot be resolved | |
SubSonic Unknown Entity Operation | An object is created for each Subsonic Persistent Object CRUD operation and respective Entity cannot be resolved | |
SubSonic SQL Query | An object is created for each direct SQL query operation found in Subsonic project and resolved in a method call | |
SubSonic Unknown SQL Query | An object is created for each direct SQL query found in Subsonic project and the exact query cannot be resolved |
Links
Link Type | Caller | Callee | APIs Supported |
---|---|---|---|
callLink | C# Method | SubSonic Entity Operation SubSonic Unknown Entity Operation |
SubSonic.ActiveList.Find SubSonic.ActiveList.SaveAll SubSonic.ActiveList.BatchSave SubSonic.ActiveRecord.Save SubSonic.ActiveRecord.FetchByID SubSonic.ActiveRecord.GetInsertCommand SubSonic.ActiveRecord.GetUpdateCommand SubSonic.ActiveRecord.GetDeleteCommand SubSonic.ActiveRecord.GetSaveCommand SubSonic.ActiveRecord.Delete SubSonic.ActiveRecord.DeleteByParameter SubSonic.ActiveRecord.Destroy SubSonic.ActiveRecord.DestroyByParameter |
callLink | C# Method | SubSonic SQL Query SubSonic Unknown SQL Query |
SubSonic.AbstractList.Load SubSonic.AbstractList.Sort SubSonic.AbstractList.OrderByAsc SubSonic.AbstractList.OrderByDesc SubSonic.AbstractList.GetListName SubSonic.AbstractList.LoadAndCloseReader SubSonic.Query.Inspect SubSonic.Query.GetRecordCount SubSonic.Query.ExecuteReader SubSonic.Query.ExecuteDataSet SubSonic.Query.ExecuteJoinedDataSet SubSonic.Query.ExecuteScalar SubSonic.Query.Execute SubSonic.DataService.ExecuteTransaction SubSonic.DataService.GetRecordCount SubSonic.DataService.GetReader.ExecuteScalar SubSonic.DataService.GetDataSet.ExecuteQuery |
useLink | SubSonic Entity Operation | Table, View | Created by SQLAnalyzer when DDL source files are analyzed |
callLink | SubSonic Entity Operation | Procedure | Created by SQLAnalyzer when DDL source files are analyzed |
useLink | SubSonic SQL Query | Table, View | Created by SQLAnalyzer when DDL source files are analyzed |
callLink | SubSonic SQL Query | Procedure | Created by SQLAnalyzer when DDL source files are analyzed |
Examples
Persistent Objects
Entity Object
using SubSonic;
using SubSonic.Utilities;
namespace MettleSystems.dashCommerce.Content
{
[Serializable]
public partial class Page : ActiveRecord<Page>
{
public Page()
{
SetSQLProps();
InitSetDefaults();
MarkNew();
}
public Page(string columnName, object columnValue)
{
SetSQLProps();
InitSetDefaults();
LoadByParam(columnName,columnValue);
}
[XmlAttribute("PageId")]
public int PageId
{
get { return GetColumnValue<int>("PageId"); }
set { SetColumnValue("PageId", value); }
}
[XmlAttribute("Title")]
public string Title
{
get { return GetColumnValue<string>("Title"); }
set { SetColumnValue("Title", value); }
}
[XmlAttribute("MenuTitle")]
public string MenuTitle
{
get { return GetColumnValue<string>("MenuTitle"); }
set { SetColumnValue("MenuTitle", value); }
}
[XmlAttribute("Description")]
public string Description
{
get { return GetColumnValue<string>("Description"); }
set { SetColumnValue("Description", value); }
}
}
}
CRUD Operations
Insert Operation
using SubSonic;
using SubSonic.Utilities;
namespace Subsonic.Crud {
class Program {
static void Main(string[] args) {
public static void Insert(Guid varPageGuid,int varParentId,string varTitle,string varMenuTitle,string varKeywords,string varDescription,int varSortOrder,int varTemplateId,string varCreatedBy,DateTime varCreatedOn,string varModifiedBy,DateTime varModifiedOn)
{
Page item = new Page();
item.PageGuid = varPageGuid;
item.ParentId = varParentId;
item.Title = varTitle;
item.MenuTitle = varMenuTitle;
item.Keywords = varKeywords;
item.Description = varDescription;
if (System.Web.HttpContext.Current != null)
item.Save(System.Web.HttpContext.Current.User.Identity.Name);
else
item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
}
}
}
}
Select Operation
using SubSonic;
using SubSonic.Utilities;
namespace Subsonic.Crud {
class Program {
static void Main(string[] args) {
public MettleSystems.dashCommerce.Content.Page Page
{
get { return MettleSystems.dashCommerce.Content.Page.FetchByID(this.PageId); }
set { SetColumnValue("PageId", value.PageId); }
}
}
}
Delete Operation
using SubSonic;
using SubSonic.Utilities;
namespace Subsonic.Crud {
class Program {
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public bool Delete(object PageId)
{
return (Page.Delete(PageId) == 1);
}
}
}
Query Based CRUD Operations
Raw Query Operation
namespace Subsonic.Crud{
class Program {
public static void SaveRegionMap(int varPageId, RegionCollection items)
{
QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
//delete out the existing
QueryCommand cmdDel = new QueryCommand("DELETE FROM dashCommerce_Content_Page_Region_Map WHERE PageId=@PageId", Page.Schema.Provider.Name);
cmdDel.AddParameter("@PageId", varPageId);
coll.Add(cmdDel);
DataService.ExecuteTransaction(coll);
foreach (Region item in items)
{
PageRegionMap varPageRegionMap = new PageRegionMap();
varPageRegionMap.SetColumnValue("PageId", varPageId);
varPageRegionMap.SetColumnValue("RegionId", item.GetPrimaryKeyValue());
varPageRegionMap.Save();
}
}
}
Custom Query Operation
namespace Subsonic.Crud{
class Program {
[DataObjectMethod(DataObjectMethodType.Select, true)]
public PageCollection FetchAll()
{
PageCollection coll = new PageCollection();
Query qry = new Query(Page.Schema);
coll.LoadAndCloseReader(qry.ExecuteReader());
return coll;
}
}
}