Sub Sonic - 1.0


Extension ID

com.castsoftware.dotnet.subsonic

What’s new?

Please see 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 SubSonicexternal link SubSonic 2.0.0.0 to 2.2.0.0

Function Point, Quality and Sizing support

  • Function Points (transactions): a green tick indicates that OMG Function Point counting and Transaction Risk Index are supported
  • Quality and Sizing: a green tick indicates that CAST can measure size and that a minimum set of Quality Rules exist
Function Points (transactions) Quality and Sizing

Compatibility

Release Operating System Supported
v3/8.4.x Microsoft Windows / Linux
v2/8.3.x Microsoft Windows

Download and installation instructions

For applications using any of the above mentionned libraries, this extension will be automatically installed. For upgrade, if the Extension Strategy is not set to Auto Update, you can manually upgrade the extension.

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
entity_icon SubSonic Entity An object is created for each Subsonic Persistent Object
entity_operation SubSonic Entity Operation An object is created for each Subsonic Persistent Object CRUD operation
unknown_entity_icon SubSonic Unknown Entity An object is created for when Subsonic Persistent Object cannot be resolved
unknown_entity_operation SubSonic Unknown Entity Operation An object is created for each Subsonic Persistent Object CRUD operation and respective Entity cannot be resolved
sql_query_icon SubSonic SQL Query An object is created for each direct SQL query operation found in Subsonic project and resolved in a method call
unknown_sql_query_icon SubSonic Unknown SQL Query An object is created for each direct SQL query found in Subsonic project and the exact query cannot be resolved
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
{
	public partial class Credit : ActiveRecord<Credit>
	{		
		public Credit(bool useDatabaseDefaults)
		{
			SetSQLProps();
			if(useDatabaseDefaults)
				ForceDefaults();
			MarkNew();
		}
		
		  
		[XmlAttribute("CreditID")]
		public int CreditID 
		{
			get { return GetColumnValue<int>("CreditID"); }
			set { SetColumnValue("CreditID", value); }

		}
		  
		[XmlAttribute("AccountID")]
		public string AccountID 
		{
			get { return GetColumnValue<string>("AccountID"); }
			set { SetColumnValue("AccountID", value); }

		}		  
		[XmlAttribute("Amount")]
		public decimal Amount 
		{
			get { return GetColumnValue<decimal>("Amount"); }
			set { SetColumnValue("Amount", value); }

		}
		public struct Columns
		{
			 public static string CreditID = @"CreditID";
			 public static string AccountID = @"AccountID";
			 public static string Amount = @"Amount";
						
		}
	}
}

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;
        }
	}
}