GPAL.Database starts the chain. WithConnectionString takes a full connection string directly, or WithServerName, WithDatabaseName, WithUsername, and WithPassword build one up piece by piece. WithDatabaseType(DatabaseType.SQLServer) says which database this is. SQLServer is the only one GPAL speaks, and it is what generates the SQL when you use the higher-level Create/Read/Update/Delete actions rather than a raw WithSQLCommand.
var db = GPAL
// Or build the connection string yourself
var db2 = GPAL
// how long a command may run, and letting the connection go when the work is done
using (IGPALDatabase db3 = GPAL
{
db3
db3
GPAL
}
// or hand the connection back without disposing, and keep using the same object
db
A connection opens on the first action and stays open, so a workflow holding a database is holding a connection. Close() hands it back, rolling back a transaction still open on it, and the database works afterwards: the next action opens a new connection from the same settings. GPALDatabase is IDisposable for the same job, so it can be held in a using block. WithCommandTimeout(seconds) says how long a command may run. Nothing said leaves the provider's own default, which is thirty seconds for SQL Server, and a report or a wide update often needs more. Zero is SQL Server's word for no limit. A read that returns one value has its own SaveTo. SaveTo(out string) runs the query and takes the first column of the first row, without building a grid around it, and hands back null when the query returned no rows or returned null.
Two paths are available for executing SQL. You can supply a raw SQL string directly and execute it -- the simplest option when you already know exactly what you want to run, including stored procedures. Or you can use the built-in Create, Read, Update, and Delete operations, which accept parameterized SQL, bind values from a grid or individual parameters, and return results into a grid or data table. Both paths end with the same Execute call and return a row count.
// Raw SQL command
int rowCount;
GPAL
// Parameterized read into a grid
IGPALGrid<string> results;
GPAL
// Insert rows from a grid built elsewhere in the workflow
GPAL
A parameterized command needs to know the type of each @name it uses, and that is what the parameter methods declare. Integers, strings, decimals, datetimes, and table-valued parameters are all covered, with length, precision, and scale set as follow-on calls after the type. The declarations line up in order with the columns of the grid handed to Using, so a single chain writes every row in the grid. GPAL does not create tables. It talks to the ones already there.
GPAL
+ "VALUES (@CustomerId, @Total, @PlacedOn, @Status)")
There is no boolean or bit type in GPAL. The recommended pattern is a nullable Datetime column: NULL represents false, meaning the event has not occurred, and a set date represents true. It carries the exact timestamp for free. A DeletedOn column tells you whether a record was deleted and when, at no added cost over a simple flag. Declare it with WithDatetimeParameter and allow nulls in the table.
Showing off some plain text in these paragraphs eligendi laboriosam illo nostrum corporis at libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Obcaecati, iste distinctio veritatis eligendi laboriosam illo nostrum corporis at libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Obcaecati, iste distinctio veritatis eligendi laboriosam illo nostrum corporis at libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo veniam mollitia excepturi animi eum illum non libero sapiente provident assumenda, delectus voluptatum nobis sed dolorem adipisci laudantium incidunt. Error, ratione?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo veniam mollitia excepturi animi eum illum non libero sapiente provident assumenda, delectus voluptatum nobis sed dolorem adipisci laudantium incidunt. Error, ratione?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo veniam mollitia excepturi animi eum illum non libero sapiente provident assumenda, delectus voluptatum nobis sed dolorem adipisci laudantium incidunt. Error, ratione?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo veniam mollitia excepturi animi eum illum non libero sapiente provident assumenda, delectus voluptatum nobis sed dolorem adipisci laudantium incidunt. Error, ratione?
Here you can find different accents and emphasis sit amet consectetur adipisicing elit. Obcaecati, iste distinctio veritatis eligendi laboriosam illo nostrum corporis at libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta!
This is a link and how it could look like bestlinkinthebeautifulworld. Obcaecati, iste distinctio veritatis eligendi laboriosam illo nostrum corporis at libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta!
Here's just some classic bold text adipisicing elit. Obcaecati, iste distinctio veritatis eligendi laboriosam notBoldSecondbestlinkinthebeautifulworld illo nostrum corporis at libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta!
Obcaecati, iste distinctio veritatis eligendi laboriosam adipisicing elit illo nostrum corporis at adipisicing elit libero vel voluptas? Expedita, adipisicing facere dolores voluptatem ad ab rem assumenda soluta!
Other cuple of colors in case we want to emphasize several ways adipisicing elit. Obcaecati, iste distinctio veritatis eligendi laboriosam adipisicing elit illo nostrum corporis at voluptatem libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Obcaecati, iste distinctio veritatis eligendi laboriosam illo nostrum corporis at libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta! Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quod veniam, quam ad expedita laborum sed at voluptates culpa ipsam ut vel. Ullam temporibus a mollitia quod aliquam ratione exercitationem nesciunt.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Obcaecati, iste distinctio veritatis eligendi laboriosam illo nostrum corporis at libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta! Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quod veniam, quam ad expedita laborum sed at voluptates culpa ipsam ut vel. Ullam temporibus a mollitia quod aliquam ratione exercitationem nesciunt.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Obcaecati, iste distinctio veritatis eligendi laboriosam illo nostrum corporis at libero vel voluptas? Expedita, facere dolores voluptatem ad ab rem assumenda soluta!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Repudiandae quas consequuntur illo numquam assumenda autem exercitationem distinctio perspiciatis in natus. Eius dicta similique ipsam ipsa minima, nemo quae enim tempore.
GPAL
.CallIfNotFound(GenericCallIfNotFound)
.WithPublishToConsole();
//System.Drawing.Rectangle windowSize = new System.Drawing.Rectangle(10, 10, 1500, 1024);
// NOTE: we have to set browser = before we execute any steps
// this is due to the 'GenericCallIfNotFound' which might throw an exception, and BankScraper will not have the browser set when it calls scraper.Close()
// until the complete fluent line gets executed (meaning every step, meaning browser is not set until everything else succeeds)
browser = GPAL.Browser
.WithBrowserType(Enums.BrowserType.Chrome)
.WithProfileDataDirectory(ChromeProfileLocation)
.WithUseAutomationEngine(AutomationEngine.Selenium)
.WithWindowSize(new System.Drawing.Rectangle(0,0,1920,1080))
.ToGPALObject();