Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Make the provider extensible

未关闭
#114 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
18/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
fsharp, sql

调研方向

首先阅读 SqlDesignTime.fs 第 52 行和第 354 行附近的内容,然后将关联的 commit 和 transactional-update 示例与当前的 provider API 进行比较。该 issue 需要在实现之前确定一致认可的可扩展性设计;完成的标准是:有一个经过明确规定并记录文档的扩展 API,支持所提出的 entity 和 transaction 场景,同时不破坏当前 API。

由索引模型根据 Issue 内容生成。

描述

enhancement

I was trying to create multiple entities that have foreign key dependencies between them in a single transaction, which is not currently possible. While trying to address the problem I realized that the provider could be of much more value if it allowed the programmer to extend it. In other words if a programmer could use the types extracted from the database to add more features to the provider such as transnational creation of entities. To test my hypothesis, I modified the provider to allow extensions: https://github.com/netogallo/SQLProvider/commit/0204f4db8c8e9210b8e0df728eb0b6571c55e77f with that in place I created an example of how it can be extended to have transactional updates: https://gist.github.com/netogallo/6c85782c89544a48552c . Both of theese examples are very raw and would need improvement if they were going to be part of the provider. I just created them to explain my ideas.

Now concretely speaking, how do I want to extend the provider:

  1. The create methods of entities can accept entities as arguments where we currently accept foreign keys (SqlDesignTime.fs:354). My extension allows that but I have to change the type so it is the specific entity referenced by the relation (not any SqlEntity) but that would require more time and didn't wanna complicate it too much for a simple proposal. The referenced entities are stored differently in order to allow the entity to see the updates that happen in the referenced entity. This is what allows the transactional create to be possible since I can create the entities in the right order.

  2. Define a super-class for the "serviceType" (SqlDesignTime.fs:52). I made SqlContext the super class in the example but I think it sould be a special class designed to provide a nice API to access the information of the provider in a useful and safe way for easier extensibility.Maybe create sub-classes for all the SQL drivers so one could extend the provider with MSSQL specific extensions w/o having to extend every provider.

  3. The super-class for the "serviceType" should provide good methods to extend it's functionality. For example, the functions that are used to create insert/delete/update comands could be exposed and maybe also expose a method that takes a function (that takes a connection as an argument as an argument) and executes it inside an SqlTransaction? That way one can easily add more functionality to the type providers w/o much trouble. (With my example it is still tedious to do this, but you can).

Allowing the provider to be extended also allows it to be more modular. Ie. the basic provider infrastructure could be provided in one package and then database specific packages with the advanced functionality could be created separately so new features can be added to specific drivers w/o having to update drivers for all databases.

I volunteer to implement these changes properly, but I need advice and opinons about the proposal to know what would be the best way to make the provider extensible. On my sample, I focused on adding extensible w/o breaking the current API. Look forward for feedback.

主要语言
F#
星标
627
派生
147
平均合并
2 小时 2 分钟
30 天内合并 PR
1

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fsprojects/SQLProvider 的其他 Issue

查看 fsprojects/SQLProvider 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。