protected override object ReadRow(IRowReader reader)
        {
            AuditAssetSearchResult auditAssetSearchResult = AuditAssetSearchResult.New();

            // Table Fields
            auditAssetSearchResult.AuditAssetSearchResultId = reader.GetInt32("AuditAssetSearchResultId");
            auditAssetSearchResult.AuditAssetSearchId       = reader.GetInt32("AuditAssetSearchId");
            auditAssetSearchResult.AssetId = reader.GetInt32("AssetId");
            auditAssetSearchResult.Date    = reader.GetDateTime("Date");


            auditAssetSearchResult.IsDirty = false;
            auditAssetSearchResult.ChangedProperties.Clear();

            return(auditAssetSearchResult);
        }
        public virtual AuditAssetSearchResult Update(AuditAssetSearchResult auditAssetSearchResult)
        {
            if (!auditAssetSearchResult.IsDirty || auditAssetSearchResult.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(auditAssetSearchResult);
            }

            IDbCommand command = CreateCommand();

            if (auditAssetSearchResult.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [AuditAssetSearchResult] ([AuditAssetSearchId], [AssetId], [Date]) VALUES (@auditAssetSearchId, @assetId, @date) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [AuditAssetSearchResult] SET [AuditAssetSearchId] = @auditAssetSearchId, [AssetId] = @assetId, [Date] = @date WHERE AuditAssetSearchResultId = @auditAssetSearchResultId";
            }

            command.Parameters.Add(CreateParameter("@auditAssetSearchId", auditAssetSearchResult.AuditAssetSearchId));
            command.Parameters.Add(CreateParameter("@assetId", auditAssetSearchResult.AssetId));
            command.Parameters.Add(CreateParameter("@date", auditAssetSearchResult.Date));

            if (auditAssetSearchResult.IsNew)
            {
                auditAssetSearchResult.AuditAssetSearchResultId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@auditAssetSearchResultId", auditAssetSearchResult.AuditAssetSearchResultId));
                ExecuteCommand(command);
            }

            auditAssetSearchResult.IsDirty = false;
            auditAssetSearchResult.ChangedProperties.Clear();

            return(auditAssetSearchResult);
        }
 public static AuditAssetSearchResult Update(AuditAssetSearchResult auditAssetSearchResult)
 {
     return(AuditAssetSearchResultMapper.Instance.Update(auditAssetSearchResult));
 }
        public static AuditAssetSearchResult FindOne(AuditAssetSearchResultFinder finder)
        {
            AuditAssetSearchResult AuditAssetSearchResult = AuditAssetSearchResultMapper.Instance.FindOne(finder);

            return(AuditAssetSearchResult ?? Empty);
        }
        public static AuditAssetSearchResult Get(Nullable <Int32> AuditAssetSearchResultId)
        {
            AuditAssetSearchResult AuditAssetSearchResult = AuditAssetSearchResultMapper.Instance.Get(AuditAssetSearchResultId);

            return(AuditAssetSearchResult ?? Empty);
        }